diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props index d28fc0ff125e..a96c9475b518 100644 --- a/eng/Packages.Data.props +++ b/eng/Packages.Data.props @@ -176,7 +176,7 @@ All should have PrivateAssets="All" set so they don't become package dependencies --> - + diff --git a/eng/emitter-package-lock.json b/eng/emitter-package-lock.json index 6855539b94ec..56efe1a7eb37 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.20231019.3" + "@azure-tools/typespec-csharp": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest@local/npm/registry/@azure-tools/typespec-csharp/-/typespec-csharp-0.2.0-alpha.20231022.3.tgz" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -17,9 +17,9 @@ } }, "node_modules/@autorest/csharp": { - "version": "3.0.0-beta.20231019.3", - "resolved": "https://registry.npmjs.org/@autorest/csharp/-/csharp-3.0.0-beta.20231019.3.tgz", - "integrity": "sha512-JQaWfztvbJ+Y7nKjQI2ssMIUB2tnj2FmN+CU8qUjVHhQaeHYKkSC/DkyA/bXl0ep4ICuDCrVb04R4B+qNeF3kA==" + "version": "3.0.0-alpha.20231022.3", + "resolved": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest@local/npm/registry/@autorest/csharp/-/csharp-3.0.0-alpha.20231022.3.tgz", + "integrity": "sha512-ZgpVCkPCH4Hr5Oe5uERuubx+RfERXt/2xEqGVni4em5SR01DFA2vv6og0Go07sx3ErVxK6Rh/mXNXstHdWA+Sw==" }, "node_modules/@azure-tools/typespec-azure-core": { "version": "0.35.0", @@ -49,11 +49,12 @@ } }, "node_modules/@azure-tools/typespec-csharp": { - "version": "0.2.0-beta.20231019.3", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-csharp/-/typespec-csharp-0.2.0-beta.20231019.3.tgz", - "integrity": "sha512-DXBA3gVv/WDZfGZeJZjFrO7TwX+Zz+qpq/+BmtjHIYZLwmm9+TtG1FWJ1UunkpfpChvhs8daHda6spWzgPLLuQ==", + "version": "0.2.0-alpha.20231022.3", + "resolved": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest@local/npm/registry/@azure-tools/typespec-csharp/-/typespec-csharp-0.2.0-alpha.20231022.3.tgz", + "integrity": "sha512-n7xUALN88ncLNOiDSzc8IPus0P3KELrypnwlZcGAv0xTlQkpjxlvTyiAMG00hO41hGyY9OSwqmeWQZ8l3goloA==", + "license": "MIT", "dependencies": { - "@autorest/csharp": "3.0.0-beta.20231019.3", + "@autorest/csharp": "3.0.0-alpha.20231022.3", "@azure-tools/typespec-azure-core": "0.35.0", "@azure-tools/typespec-client-generator-core": "0.35.0", "@typespec/compiler": "0.49.0", @@ -185,19 +186,19 @@ "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, "node_modules/@eslint/js": { - "version": "8.51.0", - "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.51.0.tgz", - "integrity": "sha512-HxjQ8Qn+4SI3/AFv6sOrDB+g6PpUTDwSJiQqOrnneEk8L71161srI9gjzzZvYVbzHiVg/BvcH95+cK/zfIt4pg==", + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/@eslint/js/-/js-8.52.0.tgz", + "integrity": "sha512-mjZVbpaeMZludF2fsWLD0Z9gCref1Tk4i9+wddjRvpUNqqcndPkBD09N/Mapey0b3jaXbLm2kICwFv2E64QinA==", "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, "node_modules/@humanwhocodes/config-array": { - "version": "0.11.12", - "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.12.tgz", - "integrity": "sha512-NlGesA1usRNn6ctHCZ21M4/dKPgW9Nn1FypRdIKKgZOKzkVV4T1FlK5mBiLhHBCDmEbdQG0idrcXlbZfksJ+RA==", + "version": "0.11.13", + "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", + "integrity": "sha512-JSBDMiDKSzQVngfRjOdFXgFfklaXI4K9nLF49Auh21lmBWRLIK3+xTErTWD4KU54pb6coM6ESE7Awz/FNU3zgQ==", "dependencies": { - "@humanwhocodes/object-schema": "^2.0.0", + "@humanwhocodes/object-schema": "^2.0.1", "debug": "^4.1.1", "minimatch": "^3.0.5" }, @@ -218,9 +219,9 @@ } }, "node_modules/@humanwhocodes/object-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.0.tgz", - "integrity": "sha512-9S9QrXY2K0L4AGDcSgTi9vgiCcG8VcBv4Mp7/1hDPYoswIy6Z6KO5blYto82BT8M0MZNRWmCFLpCs3HlpYGGdw==" + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@humanwhocodes/object-schema/-/object-schema-2.0.1.tgz", + "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==" }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", @@ -751,6 +752,11 @@ "@typespec/compiler": "~0.49.0" } }, + "node_modules/@ungap/structured-clone": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@ungap/structured-clone/-/structured-clone-1.2.0.tgz", + "integrity": "sha512-zuVdFrMJiuCDQUMCzQaD6KL28MjnqqN8XnAqiEq9PNm/hCPTSGfrXCOfwj1ow4LFb/tNymJPwsNbVePc1xFqrQ==" + }, "node_modules/acorn": { "version": "8.10.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.10.0.tgz", @@ -1186,17 +1192,18 @@ } }, "node_modules/eslint": { - "version": "8.51.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.51.0.tgz", - "integrity": "sha512-2WuxRZBrlwnXi+/vFSJyjMqrNjtJqiasMzehF0shoLaW7DzS3/9Yvrmq5JiT66+pNjiX4UBnLDiKHcWAr/OInA==", + "version": "8.52.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-8.52.0.tgz", + "integrity": "sha512-zh/JHnaixqHZsolRB/w9/02akBk9EPrOs9JwcTP2ek7yL5bVvXuRariiaAjjoJ5DvuwQ1WAE/HsMz+w17YgBCg==", "dependencies": { "@eslint-community/eslint-utils": "^4.2.0", "@eslint-community/regexpp": "^4.6.1", "@eslint/eslintrc": "^2.1.2", - "@eslint/js": "8.51.0", - "@humanwhocodes/config-array": "^0.11.11", + "@eslint/js": "8.52.0", + "@humanwhocodes/config-array": "^0.11.13", "@humanwhocodes/module-importer": "^1.0.1", "@nodelib/fs.walk": "^1.2.8", + "@ungap/structured-clone": "^1.2.0", "ajv": "^6.12.4", "chalk": "^4.0.0", "cross-spawn": "^7.0.2", @@ -1839,6 +1846,14 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/get-caller-file": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", @@ -1930,14 +1945,6 @@ "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==" }, - "node_modules/has": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.4.tgz", - "integrity": "sha512-qdSAmqLF6209RFj4VVItywPMbm3vWylknmB3nvNiUIs72xAimcM8nVYxYr7ncvZq5qzk9MKIZR8ijqD/1QuYjQ==", - "engines": { - "node": ">= 0.4.0" - } - }, "node_modules/has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", @@ -1946,6 +1953,17 @@ "node": ">=4" } }, + "node_modules/hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/header-case": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/header-case/-/header-case-2.0.4.tgz", @@ -2041,11 +2059,11 @@ } }, "node_modules/is-core-module": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", - "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dependencies": { - "has": "^1.0.3" + "hasown": "^2.0.0" }, "funding": { "url": "https://github.com/sponsors/ljharb" diff --git a/eng/emitter-package.json b/eng/emitter-package.json index 92ecd82e63a2..76acb30baf72 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,6 +1,9 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-csharp": "0.2.0-beta.20231019.3" + "@azure-tools/typespec-csharp": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest@local/npm/registry/@azure-tools/typespec-csharp/-/typespec-csharp-0.2.0-alpha.20231022.3.tgz" + }, + "overrides": { + "@autorest/csharp": "https://pkgs.dev.azure.com/azure-sdk/public/_packaging/azure-sdk-for-js-test-autorest@local/npm/registry/@autorest/csharp/-/csharp-3.0.0-alpha.20231022.3.tgz" } } 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 25075484a230..c5b7ff693fca 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 fad87f407baa..000000000000 --- 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 000000000000..9a4b0a4f85d9 --- /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 000000000000..13d2ef0b3d61 --- /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 000000000000..487c3b579780 --- /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 000000000000..59d7eb2649ef --- /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 82d84ad30583..000000000000 --- 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 8522f25ddb5e..000000000000 --- 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 80d853e6ef1b..000000000000 --- 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/ResourceRecommendationBaseResource.cs b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseResource.cs index ac101318f892..b25c8da7b2f1 100644 --- a/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseResource.cs +++ b/sdk/advisor/Azure.ResourceManager.Advisor/src/Generated/ResourceRecommendationBaseResource.cs @@ -90,7 +90,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 +108,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 +131,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/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/AgFoodPlatformExtensions.cs b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/Extensions/AgFoodPlatformExtensions.cs index b8c180120633..21e9afb3de07 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 000000000000..296a3b8aa9ba --- /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 000000000000..a3a6eea9b71a --- /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 000000000000..c3c289f6f43f --- /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 000000000000..e4db68c412db --- /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 e81402522c47..000000000000 --- 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 515f535a6c99..000000000000 --- 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 5d348e71c364..000000000000 --- 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 921bc54e5779..c2aef9d04164 100644 --- a/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatResource.cs +++ b/sdk/agrifood/Azure.ResourceManager.AgFoodPlatform/src/Generated/FarmBeatResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/AlertsManagementExtensions.cs b/sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement/src/Generated/Extensions/AlertsManagementExtensions.cs index 696c1cd905bf..64b862521498 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 000000000000..567359f12230 --- /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 000000000000..e882895bdfcb --- /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 000000000000..cfe39b188489 --- /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 000000000000..1f134a22b1e0 --- /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 3fb689387e6c..000000000000 --- 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 a877d5bacda0..000000000000 --- 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 6044f8925f41..000000000000 --- 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/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/AnalysisExtensions.cs b/sdk/analysisservices/Azure.ResourceManager.Analysis/src/Generated/Extensions/AnalysisExtensions.cs index 7c9add1f4564..a6401d183a71 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 000000000000..839d8bc7c7cc --- /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 000000000000..539da24a6984 --- /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 000000000000..8bfad24f121e --- /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 a8e8918ddb9e..000000000000 --- 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 26ad12d2073c..000000000000 --- 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/src/Generated/Extensions/ApiCenterExtensions.cs b/sdk/apicenter/Azure.ResourceManager.ApiCenter/src/Generated/Extensions/ApiCenterExtensions.cs index 49aee9aaaf89..501f1fa21e9c 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 000000000000..6cbc98792bfd --- /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 000000000000..1febef32b3f4 --- /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 000000000000..436fda06e129 --- /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 bdd156bb3e0d..000000000000 --- 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 b92d0fd59902..000000000000 --- 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/src/Generated/ApiIssueResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueResource.cs index b3b97299b544..16d098f15f8b 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiIssueResource.cs @@ -91,7 +91,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 +109,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 +132,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 +144,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 +162,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 +185,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/ApiManagementGatewayResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayResource.cs index 3763ef75b01e..0f58cdc5f151 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementGatewayResource.cs @@ -96,7 +96,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 +114,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 +137,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 +149,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 +167,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 +190,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/ApiManagementProductResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductResource.cs index 35ab6ba07b7c..af6d300f2e3c 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementProductResource.cs @@ -104,7 +104,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 +155,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 +173,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 +196,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/ApiManagementServiceResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceResource.cs index 1b89d70f1f12..84e9bb4578fd 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementServiceResource.cs @@ -161,7 +161,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 +179,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 +202,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 +214,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 +265,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 +283,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 +306,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 +318,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 +336,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 +359,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 +371,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 +389,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 +412,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 +424,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 +442,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 +465,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 +477,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 +495,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 +518,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 +530,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 +548,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 +571,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 +583,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 +601,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 +624,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 +636,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 +654,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 +677,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 +689,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 +738,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 +756,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 +779,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 +791,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 +809,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 +832,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 +844,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 +893,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 +911,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 +934,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 +946,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 +964,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 +987,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 +999,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 +1048,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 +1066,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 +1089,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 +1101,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 +1119,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 +1142,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 +1175,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 +1193,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 +1216,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 +1228,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 +1246,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 +1269,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 +1281,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 +1299,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 +1322,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 +1334,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 +1352,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 +1375,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 +1387,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 +1436,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 +1454,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 +1477,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 +1489,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 +1538,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 +1556,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 +1579,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/ApiManagementUserResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs index 287453f9eafd..16ea4e0fe799 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiManagementUserResource.cs @@ -104,7 +104,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 +122,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 +145,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/ApiOperationResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationResource.cs index 2aedff01129d..5baf287eafe3 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiOperationResource.cs @@ -91,7 +91,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 +142,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 +160,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 +183,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/ApiResource.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs index 4cf65f833cf0..e3da564d1a95 100644 --- a/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs +++ b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/ApiResource.cs @@ -104,7 +104,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 +122,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 +145,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 +157,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 +175,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 +198,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 +210,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 +261,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 +279,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 +302,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 +314,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 +332,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 +355,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 +367,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 +385,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 +408,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 +420,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 +439,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 +463,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 +475,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 +493,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 +516,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/Extensions/ApiManagementExtensions.cs b/sdk/apimanagement/Azure.ResourceManager.ApiManagement/src/Generated/Extensions/ApiManagementExtensions.cs index 21bf4ef2b572..2661f3617c17 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 000000000000..996931579f57 --- /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 000000000000..f67738919492 --- /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 000000000000..d49e522f989c --- /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 424939d021d5..000000000000 --- 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 b0e7d9db183e..000000000000 --- 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/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Extensions/AppComplianceAutomationExtensions.cs b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/Extensions/AppComplianceAutomationExtensions.cs index ff726ecb921f..8902ddd2616d 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 000000000000..6aac8bfa4b8a --- /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 000000000000..6683707f4410 --- /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 4aa288688b79..000000000000 --- 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 ef8c111c5c9e..f78158d5aa8a 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResource.cs +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/Generated/ReportResource.cs @@ -92,7 +92,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 +110,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 +133,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/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreResource.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreResource.cs index f8e89f86a9ec..7e57eaf5509c 100644 --- a/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreResource.cs +++ b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/AppConfigurationStoreResource.cs @@ -94,7 +94,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 +112,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 +135,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 +147,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 +165,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 +188,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 +200,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 +218,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 +241,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/Extensions/AppConfigurationExtensions.cs b/sdk/appconfiguration/Azure.ResourceManager.AppConfiguration/src/Generated/Extensions/AppConfigurationExtensions.cs index 19bdec3a69ec..4296c8d3be26 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 000000000000..6b917ed5dacc --- /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 000000000000..2e46c36ff418 --- /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 000000000000..78b1a43fd777 --- /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 aeccdc3ce25d..000000000000 --- 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 38b913e098b6..000000000000 --- 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/src/Generated/ApplicationInsightsComponentResource.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentResource.cs index cf8e7b14dbbc..d007486758d5 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentResource.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/ApplicationInsightsComponentResource.cs @@ -147,7 +147,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/Extensions/ApplicationInsightsExtensions.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/Extensions/ApplicationInsightsExtensions.cs index d6ac02a73524..02a132ccd0e6 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 89c956e7f076..000000000000 --- 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 000000000000..4b551627f9be --- /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 000000000000..07a98a3f058c --- /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 000000000000..7ff44134dd1b --- /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 312f16219f00..000000000000 --- 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 ba6c2fd5c912..000000000000 --- 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/WorkbookResource.cs b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookResource.cs index 250fe2f8ef9c..82ff6fdccf84 100644 --- a/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookResource.cs +++ b/sdk/applicationinsights/Azure.ResourceManager.ApplicationInsights/src/Generated/WorkbookResource.cs @@ -93,7 +93,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 +111,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 +134,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/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalResource.cs index 27e5bfa4addc..3e0b1bd29640 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformApiPortalResource.cs @@ -91,7 +91,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 +109,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 +132,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 7b5721c54a65..5eedbc00fab0 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformAppResource.cs @@ -91,7 +91,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 +109,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 +132,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 +144,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 +162,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 +185,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 +197,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 +215,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 +238,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/AppPlatformBuildResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResource.cs index 3736a727acef..5eef91f42525 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildResource.cs @@ -90,7 +90,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 +108,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 +131,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/AppPlatformBuildServiceResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceResource.cs index 03053830625d..647ab4445cdd 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuildServiceResource.cs @@ -91,7 +91,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 +109,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 +132,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 +144,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 +162,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 +185,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 +197,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 +215,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 +238,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 +250,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 +268,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 +291,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 +303,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 +321,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 +344,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 d99eb8506a86..d63a9174a1e9 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformBuilderResource.cs @@ -91,7 +91,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 +109,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 +132,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/AppPlatformGatewayResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayResource.cs index 2a4a52e4a3b9..69696fe19e2e 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformGatewayResource.cs @@ -91,7 +91,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 +109,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 +132,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 +144,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 +162,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 +185,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/AppPlatformServiceResource.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceResource.cs index d9a3afe487d4..883b33e7a36a 100644 --- a/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceResource.cs +++ b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/AppPlatformServiceResource.cs @@ -111,7 +111,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 +129,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 +152,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 +164,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 +182,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 +205,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 +217,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 +235,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 +258,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 +277,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 +296,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 +320,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 +332,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 +350,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 +373,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 +385,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 +403,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 +426,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 +438,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 +456,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 +479,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 +491,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 +509,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 +532,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/Extensions/AppPlatformExtensions.cs b/sdk/appplatform/Azure.ResourceManager.AppPlatform/src/Generated/Extensions/AppPlatformExtensions.cs index 1516512c796b..d8df28f7a1ce 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 000000000000..68bfe33b07d3 --- /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 000000000000..ad4ce20855a7 --- /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 000000000000..d660e5a8339f --- /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 000000000000..51f6688558d2 --- /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 400370c8364b..000000000000 --- 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 d08e81e73920..000000000000 --- 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 57a5c43f0530..000000000000 --- 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/src/Generated/Extensions/ArcScVmmExtensions.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/Extensions/ArcScVmmExtensions.cs index 98a949481305..d49cae70ef64 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 000000000000..7c5048cb3a37 --- /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 000000000000..bcd18a9c27b7 --- /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 000000000000..4d96a7806b74 --- /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 4cdb2ba54f5d..000000000000 --- 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 3b8b499bc428..000000000000 --- 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/ScVmmServerResource.cs b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerResource.cs index b8d3ba732e58..2353fc8c5a31 100644 --- a/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerResource.cs +++ b/sdk/arc-scvmm/Azure.ResourceManager.ArcScVmm/src/Generated/ScVmmServerResource.cs @@ -93,7 +93,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 +111,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 +134,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/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.cs b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.cs index f29ea881582e..bb703a4b40ad 100644 --- a/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.cs +++ b/sdk/attestation/Azure.ResourceManager.Attestation/src/Generated/AttestationProviderResource.cs @@ -98,7 +98,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 +116,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 +139,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 2eb6d2f9fa27..287530942b9f 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 000000000000..94468aa48695 --- /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 000000000000..c388fb621aab --- /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 000000000000..d46ee47c26aa --- /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 d6350d52e2ff..000000000000 --- 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 feff75ddea9d..000000000000 --- 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/samples/Generated/Samples/Sample_ArmResourceExtensions.cs b/sdk/authorization/Azure.ResourceManager.Authorization/samples/Generated/Samples/Sample_ArmResourceExtensions.cs deleted file mode 100644 index cd8ab4c9bd34..000000000000 --- 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/Extensions/ArmResourceExtensionClient.cs b/sdk/authorization/Azure.ResourceManager.Authorization/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index 3022e42d44c9..000000000000 --- 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 04f0656d20a8..17e78c1f633c 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 000000000000..dc0cf07c99bc --- /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 000000000000..4edd9c0206ce --- /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 000000000000..0b04be1b0529 --- /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 000000000000..030b4690d1e2 --- /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 000000000000..ec42976f1425 --- /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 ccda8fa0f68e..000000000000 --- 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 e92eb289b53a..000000000000 --- 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 0a3ef7b8099e..000000000000 --- 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/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileResource.cs index 9066d58d1d95..9e1428feac2f 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileResource.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageConfigurationProfileResource.cs @@ -93,7 +93,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 +111,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 +134,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/AutomanageHciClusterConfigurationProfileAssignmentResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentResource.cs index 12dbc7410397..741f48449c5c 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentResource.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHciClusterConfigurationProfileAssignmentResource.cs @@ -90,7 +90,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 +108,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 +131,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/AutomanageHcrpConfigurationProfileAssignmentResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentResource.cs index 8ab0eb8e6227..1283ac5eafea 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentResource.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageHcrpConfigurationProfileAssignmentResource.cs @@ -90,7 +90,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 +108,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 +131,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/AutomanageVmConfigurationProfileAssignmentResource.cs b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentResource.cs index 2e19d658f010..9047035bc6ad 100644 --- a/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentResource.cs +++ b/sdk/automanage/Azure.ResourceManager.Automanage/src/Generated/AutomanageVmConfigurationProfileAssignmentResource.cs @@ -90,7 +90,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 +108,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 +131,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 1f83f1bd36a8..000000000000 --- 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 2e9f223dfa6d..50311e2e75d9 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 000000000000..f02e8b84a893 --- /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 000000000000..2bc5fe9caf61 --- /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 000000000000..ec7d7840c7cb --- /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 000000000000..f7315047b8e8 --- /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 80056435c502..000000000000 --- 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 e028579e77a9..000000000000 --- 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 a7a4d95ff048..000000000000 --- 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/src/Generated/AutomationAccountResource.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountResource.cs index 3813c0b5295d..4a3b92a16d87 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/AutomationAccountResource.cs @@ -152,7 +152,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 +170,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 +193,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 +205,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 +223,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 +246,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 +258,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 +276,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 +299,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 +311,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 +329,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 +352,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 +364,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 +382,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 +405,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 +417,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 +435,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 +458,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 +470,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 +488,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 +511,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 +523,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 +541,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 +564,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 +576,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 +594,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 +617,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 +629,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 +647,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 +670,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 +682,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 +700,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 +723,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 +735,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 +784,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 +802,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 +825,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 +837,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 +855,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 +878,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 +890,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 +908,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 +931,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 +943,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 +961,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 +984,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 +996,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 +1015,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 +1039,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 +1051,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 +1070,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 +1094,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 +1106,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 +1124,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 +1147,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 +1159,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 +1177,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 +1200,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 +1212,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 +1230,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 +1253,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/Extensions/AutomationExtensions.cs b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/Extensions/AutomationExtensions.cs index fb4adce2a7e8..30a46f19353e 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 000000000000..c9579f82643e --- /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 000000000000..1c9d13ae4fdc --- /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 000000000000..e093af78764f --- /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 7151b395f5d4..000000000000 --- 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 31a4ee41b117..000000000000 --- 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 de7b28d5bc9c..bae104b4419a 100644 --- a/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupResource.cs +++ b/sdk/automation/Azure.ResourceManager.Automation/src/Generated/HybridRunbookWorkerGroupResource.cs @@ -91,7 +91,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 +109,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 +132,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/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterResource.cs index 6a18d92c8a41..99eef752a8ae 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudClusterResource.cs @@ -92,7 +92,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 +110,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 +133,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 +145,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 +163,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 +186,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 +198,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 +216,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 +239,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/AvsPrivateCloudResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudResource.cs index 1150efd67013..163d49f32050 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/AvsPrivateCloudResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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 +305,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 +354,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 +372,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 +395,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 +407,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 +425,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 +448,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 +460,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 +478,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 +501,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 +513,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 +531,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 +554,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 +566,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 +584,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 +607,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 +619,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 +637,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 +660,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 +672,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 +690,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 +713,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 +725,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 +743,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 +766,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 +778,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 +796,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 +819,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 +831,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 +849,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 +872,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 +884,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 +902,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 +925,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 +937,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 +955,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 +978,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 +990,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 +1008,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 +1031,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/Extensions/AvsExtensions.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/Extensions/AvsExtensions.cs index d9641c4abe2c..9a6921ae501f 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 000000000000..ba7fdb815061 --- /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 000000000000..4fbe22fac5ae --- /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 000000000000..fa24cbe97cad --- /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 f27d9ee87b0d..000000000000 --- 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 44ae45f53536..000000000000 --- 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/ScriptPackageResource.cs b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageResource.cs index f00d9bde6426..176476d3e635 100644 --- a/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageResource.cs +++ b/sdk/avs/Azure.ResourceManager.Avs/src/Generated/ScriptPackageResource.cs @@ -90,7 +90,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 +108,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 +131,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/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingResource.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingResource.cs index 32ed6a53a206..79a00a629c5c 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingResource.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/ArcSettingResource.cs @@ -91,7 +91,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 +109,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 +132,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 25e60f41d1d1..a0f985d5e172 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 000000000000..532a4de0d118 --- /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 000000000000..103e50f4fc6c --- /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 000000000000..27b4e35f1a26 --- /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 a89e10777a6f..000000000000 --- 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 9b937d2dced4..000000000000 --- 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 209a217201a5..a7e80c7d6de4 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterResource.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/HciClusterResource.cs @@ -99,7 +99,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 +117,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 +140,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 +152,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 +170,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 +193,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 +212,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 +230,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 +253,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/OfferResource.cs b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferResource.cs index 5584fe0251bb..01f6a6819a3d 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferResource.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/OfferResource.cs @@ -90,7 +90,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 +109,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 +133,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 dfbe6758b34f..915c49a925b6 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherResource.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/PublisherResource.cs @@ -90,7 +90,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 +109,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 +133,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 fa00365e06fa..bbead0408d55 100644 --- a/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateResource.cs +++ b/sdk/azurestackhci/Azure.ResourceManager.Hci/src/Generated/UpdateResource.cs @@ -90,7 +90,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 +108,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 +131,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/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountResource.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountResource.cs index e636a97d9a6e..a9af55e60aa0 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountResource.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchAccountResource.cs @@ -94,7 +94,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 +112,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 +135,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 +147,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 +165,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 +188,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 +200,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 +218,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 +241,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 +253,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 +271,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 +294,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 +306,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 +324,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 +347,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 +359,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 +377,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 +400,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/BatchApplicationResource.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationResource.cs index 76bd53762a23..d2fceee91f7f 100644 --- a/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationResource.cs +++ b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/BatchApplicationResource.cs @@ -90,7 +90,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 +108,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 +131,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/Extensions/BatchExtensions.cs b/sdk/batch/Azure.ResourceManager.Batch/src/Generated/Extensions/BatchExtensions.cs index 964d5f613f4b..cbda3688e8f7 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 000000000000..ccb28ef1a5ae --- /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 000000000000..00311c9e23f2 --- /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 000000000000..4fa529810c7b --- /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 95dbff85384c..000000000000 --- 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 90cea14bd93e..000000000000 --- 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/src/Generated/Extensions/BillingExtensions.cs b/sdk/billing/Azure.ResourceManager.Billing/src/Generated/Extensions/BillingExtensions.cs index 3d964d62bf37..9ae5b1c5b877 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 000000000000..5a426c89d626 --- /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 000000000000..62a8277a2b62 --- /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 24b3e3b5fd9f..000000000000 --- 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/src/Generated/BillingBenefitsSavingsPlanOrderResource.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderResource.cs index b3ffbdd53ace..68a7c213ad1a 100644 --- a/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderResource.cs +++ b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/BillingBenefitsSavingsPlanOrderResource.cs @@ -92,7 +92,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 +111,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 +135,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/Extensions/BillingBenefitsExtensions.cs b/sdk/billingbenefits/Azure.ResourceManager.BillingBenefits/src/Generated/Extensions/BillingBenefitsExtensions.cs index af6709fdd4e8..9554266d62ff 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 000000000000..c0c65402367f --- /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 000000000000..361441cc31c7 --- /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 1508ec66d244..000000000000 --- 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/src/Generated/AssignmentResource.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentResource.cs index 78f2d75289fe..e60016304c0e 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentResource.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/AssignmentResource.cs @@ -91,7 +91,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 +109,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 +132,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/BlueprintResource.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintResource.cs index d64496c84ecb..8eb0928ababb 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintResource.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/BlueprintResource.cs @@ -96,7 +96,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 +114,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 +137,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 +149,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 +167,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 +190,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/Extensions/ArmResourceExtensionClient.cs b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index e5e798f947ba..000000000000 --- 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 d4773d4dffd3..22452b796ecf 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 000000000000..0d622c4d7c5c --- /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 27e61c7bc1c0..60b22a708333 100644 --- a/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/PublishedBlueprintResource.cs +++ b/sdk/blueprint/Azure.ResourceManager.Blueprint/src/Generated/PublishedBlueprintResource.cs @@ -90,7 +90,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 +108,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 +131,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/src/Generated/BotResource.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotResource.cs index db81696f3b2b..f9cc24e0df29 100644 --- a/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotResource.cs +++ b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/BotResource.cs @@ -106,7 +106,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 +155,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 +173,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 +196,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 +208,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 +226,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 +249,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/Extensions/BotServiceExtensions.cs b/sdk/botservice/Azure.ResourceManager.BotService/src/Generated/Extensions/BotServiceExtensions.cs index 4eb4e44ed9cc..e7214d47daa1 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 000000000000..976e82b4a5c3 --- /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 000000000000..3757eca7ddb5 --- /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 000000000000..e84f7f7ca0fe --- /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 000000000000..194143d0c9ae --- /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 ed082aca1174..000000000000 --- 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 1ee03e510f37..000000000000 --- 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 d932c20a1a6e..000000000000 --- 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/src/Generated/CdnEndpointResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointResource.cs index 75b5be037f9b..2cdf0b804239 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/CdnEndpointResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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/Extensions/CdnExtensions.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/Extensions/CdnExtensions.cs index 33559f67d6c8..7ed94c92359b 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 000000000000..b18dd1bc1747 --- /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 000000000000..9fe87d3275f6 --- /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 000000000000..1bff5ee3510c --- /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 000000000000..1cdafbdbc94b --- /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 96fe20d50a77..000000000000 --- 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 277cbfe600a8..000000000000 --- 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 979ac5c9565a..000000000000 --- 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/FrontDoorEndpointResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointResource.cs index 0444fa36d6a3..d53e72392145 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorEndpointResource.cs @@ -93,7 +93,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 +111,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 +134,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 7f21e219876a..6c83fb960687 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorOriginGroupResource.cs @@ -92,7 +92,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 +110,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 +133,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/FrontDoorRuleSetResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetResource.cs index 28a5a3bd0609..3b64c5868655 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/FrontDoorRuleSetResource.cs @@ -92,7 +92,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 +110,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 +133,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/ProfileResource.cs b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileResource.cs index 1895bb6d9b09..d134331f4361 100644 --- a/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileResource.cs +++ b/sdk/cdn/Azure.ResourceManager.Cdn/src/Generated/ProfileResource.cs @@ -102,7 +102,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 +120,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 +143,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 +155,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 +173,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 +196,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 +208,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 +226,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 +249,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 +261,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 +279,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 +302,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 +314,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 +332,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 +355,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 +367,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 +385,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 +408,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 +420,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 +438,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 +461,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/src/Generated/Extensions/ChangeAnalysisExtensions.cs b/sdk/changeanalysis/Azure.ResourceManager.ChangeAnalysis/src/Generated/Extensions/ChangeAnalysisExtensions.cs index b9522805852b..799aee5717fc 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 000000000000..75f3219d8b84 --- /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 000000000000..168579f3ebaf --- /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 000000000000..dd34455f09b9 --- /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 1a781308b800..000000000000 --- 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 1e322024f133..000000000000 --- 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 2b60242e5f21..000000000000 --- 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/src/Generated/ExperimentResource.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentResource.cs index dc58416ff238..07012ead71ab 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentResource.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/ExperimentResource.cs @@ -92,7 +92,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 +110,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 +133,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 +145,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 +163,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 +186,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/Extensions/ChaosExtensions.cs b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/Extensions/ChaosExtensions.cs index f6b1db062998..e753a12731b1 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 000000000000..b76964ba305d --- /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 000000000000..acb0d8962368 --- /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 000000000000..b4fcaf59ad00 --- /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 74cc3789b98b..000000000000 --- 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 6c32f2eb0fb8..000000000000 --- 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 d88d43085bd8..023e35bf0b9a 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetResource.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetResource.cs @@ -92,7 +92,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 +110,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 +133,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 4e9fe2287eb7..937ed326730e 100644 --- a/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeResource.cs +++ b/sdk/chaos/Azure.ResourceManager.Chaos/src/Generated/TargetTypeResource.cs @@ -91,7 +91,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 +109,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 +132,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/src/Generated/CognitiveServicesAccountResource.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountResource.cs index c6ae32bd1ca9..911e1dafca77 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesAccountResource.cs @@ -98,7 +98,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 +116,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 +139,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 +151,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 +169,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 +192,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 +204,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 +222,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 +245,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 229e7da09c57..8e9518f93699 100644 --- a/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanResource.cs +++ b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/CognitiveServicesCommitmentPlanResource.cs @@ -93,7 +93,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 +111,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 +134,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/Extensions/CognitiveServicesExtensions.cs b/sdk/cognitiveservices/Azure.ResourceManager.CognitiveServices/src/Generated/Extensions/CognitiveServicesExtensions.cs index ea024c743dd1..d55e5f9616d9 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 000000000000..8bffeebed859 --- /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 000000000000..8e863be1c673 --- /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 000000000000..6a69605accab --- /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 4933b3984746..000000000000 --- 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 1e92e72295e4..000000000000 --- 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.ResourceManager.Communication/src/Generated/CommunicationDomainResource.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResource.cs index d48bd4688e1b..36b6fbf8ec3d 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResource.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/CommunicationDomainResource.cs @@ -92,7 +92,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 +110,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 +133,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/EmailServiceResource.cs b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResource.cs index e15729698fd5..8470da6b4c6f 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResource.cs +++ b/sdk/communication/Azure.ResourceManager.Communication/src/Generated/EmailServiceResource.cs @@ -93,7 +93,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 +111,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 +134,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 5d35a0e2ef53..7d8b92d46777 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 000000000000..6a199223e3f2 --- /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 000000000000..74e94da7aefa --- /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 000000000000..36ff6f48856a --- /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 868a4b8209e5..000000000000 --- 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 00e0cd5492fc..000000000000 --- 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/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupResource.cs index b7dc98451718..8958fbb99b77 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CapacityReservationGroupResource.cs @@ -93,7 +93,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 +112,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 +136,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/CloudServiceResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceResource.cs index eadfaa08a881..892d6cc585d3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CloudServiceResource.cs @@ -98,7 +98,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 +117,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 +141,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 +153,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 +171,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 +194,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/CommunityGalleryImageResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageResource.cs index 2a4412fefbb3..d8a8c6471d7f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryImageResource.cs @@ -90,7 +90,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 +108,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 +131,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/CommunityGalleryResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryResource.cs index 503e48fae160..9f653bd5b854 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/CommunityGalleryResource.cs @@ -91,7 +91,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 +109,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 +132,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/DedicatedHostGroupResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupResource.cs index d84d6bc3bc50..f00468ffed6b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupResource.cs @@ -93,7 +93,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 +112,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 +136,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/DiskAccessResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessResource.cs index 780ccbd4f992..f88ffc27d44e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DiskAccessResource.cs @@ -94,7 +94,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 +112,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 +135,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/Extensions/ComputeExtensions.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Extensions/ComputeExtensions.cs index 17853a10e7c1..1d7fa8b0976d 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 000000000000..662f38f1e829 --- /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 000000000000..f7d0743b519d --- /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 000000000000..0d8899125cec --- /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 6b96a81aa94e..000000000000 --- 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 e4547c00bc68..000000000000 --- 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 2cf0bf47d710..185cb6068f85 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryApplicationResource.cs @@ -92,7 +92,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 +111,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 +135,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/GalleryImageResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageResource.cs index 05e09bca64dd..c30b8c26e115 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryImageResource.cs @@ -92,7 +92,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 +111,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 +135,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/GalleryResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryResource.cs index fb762f4e5873..4a70ffbb5764 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/GalleryResource.cs @@ -97,7 +97,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 +115,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 +138,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 +150,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 +168,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 +191,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/RestorePointGroupResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupResource.cs index 1de5f376d529..2a555a987d49 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointGroupResource.cs @@ -93,7 +93,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 +112,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 +136,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 508dbb47f693..da40d7e96478 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointResource.cs @@ -91,7 +91,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 +109,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 +132,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 fe8a1321ad66..3caaec8bfb24 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryImageResource.cs @@ -90,7 +90,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 +108,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 +131,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/SharedGalleryResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryResource.cs index d8b916ec9cfe..e79a879eeac8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/SharedGalleryResource.cs @@ -91,7 +91,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 +109,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 +132,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/VirtualMachineResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineResource.cs index 9dbd74a2499b..f7ff4fd6f0da 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineResource.cs @@ -94,7 +94,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 +113,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 +137,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 +149,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 +168,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 +192,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/VirtualMachineScaleSetResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetResource.cs index eb9c1861fb8e..b872509a6f58 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetResource.cs @@ -99,7 +99,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 +118,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 +142,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 +161,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 +180,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 +204,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/VirtualMachineScaleSetVmResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmResource.cs index 58bdecf9c054..85de3de6b11f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVmResource.cs @@ -92,7 +92,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 +111,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 +135,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 +147,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 +166,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 +190,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/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ConfidentialLedgerExtensions.cs b/sdk/confidentialledger/Azure.ResourceManager.ConfidentialLedger/src/Generated/Extensions/ConfidentialLedgerExtensions.cs index acff73bfcdcd..f2a07bcbc5a4 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 000000000000..ce85364c15ed --- /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 000000000000..e383685fca48 --- /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 000000000000..d8625191863d --- /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 09ae729cb59b..000000000000 --- 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 d0c451dbd52c..000000000000 --- 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/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/ConfluentExtensions.cs b/sdk/confluent/Azure.ResourceManager.Confluent/src/Generated/Extensions/ConfluentExtensions.cs index 4c9f0b3974b7..66fd1713ed04 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 000000000000..98a5b8f68a8f --- /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 000000000000..4405701c7f46 --- /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 000000000000..e5733b168ea2 --- /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 cfbed6988078..000000000000 --- 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 d4cb9560bd9c..000000000000 --- 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/src/Generated/Extensions/ConnectedVMwarevSphereExtensions.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/Extensions/ConnectedVMwarevSphereExtensions.cs index a8e1c605b81d..2813677f0ee5 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 000000000000..b74b9851334f --- /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 000000000000..a826cb5115f8 --- /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 000000000000..17ce47a83aa3 --- /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 3083e6dd87cf..000000000000 --- 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 d530956dd13c..000000000000 --- 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/VCenterResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterResource.cs index 1fb819a4f4e2..e8d54d2b4fb5 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterResource.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VCenterResource.cs @@ -93,7 +93,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 +111,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 +134,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/VirtualMachineResource.cs b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineResource.cs index a872fc6c6743..d984702f0429 100644 --- a/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineResource.cs +++ b/sdk/connectedvmwarevsphere/Azure.ResourceManager.ConnectedVMwarevSphere/src/Generated/VirtualMachineResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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/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 1c9784822ec2..000000000000 --- 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 bcda22d401c4..41ecf06c3397 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 4edc6c3a5dbc..000000000000 --- 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 000000000000..100744245390 --- /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 000000000000..563b94a8b3c1 --- /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 000000000000..7f06e2d908fd --- /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 000000000000..be5f28c68b06 --- /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 5a5d7630ac7e..000000000000 --- 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 6cad8c23f0ab..000000000000 --- 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/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentResource.cs index f839095b13ad..362437fccd9f 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppConnectedEnvironmentResource.cs @@ -92,7 +92,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 +110,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 +133,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 +145,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 +163,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 +186,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 +198,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 +216,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 +239,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/ContainerAppJobResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobResource.cs index 72b75d9170bc..d80f7f2aeef0 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppJobResource.cs @@ -94,7 +94,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 +112,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 +135,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/ContainerAppManagedEnvironmentResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentResource.cs index 69508e54c373..783b0374700c 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppManagedEnvironmentResource.cs @@ -98,7 +98,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 +116,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 +139,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 +151,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 +169,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 +192,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 +204,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 +222,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 +245,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 +264,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 +282,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 +305,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 +317,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 +335,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 +358,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/ContainerAppResource.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppResource.cs index b26a11bf61b7..a23958deecd9 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppResource.cs @@ -94,7 +94,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 +112,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 +135,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 +154,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 +172,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 +195,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 +207,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 +225,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 +248,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 +260,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 +278,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 +301,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 +313,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 +331,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 +354,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 315e5b9287fb..4339e4dfcd62 100644 --- a/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionResource.cs +++ b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/ContainerAppRevisionResource.cs @@ -90,7 +90,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 +108,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 +131,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/Extensions/AppContainersExtensions.cs b/sdk/containerapps/Azure.ResourceManager.AppContainers/src/Generated/Extensions/AppContainersExtensions.cs index d13aae243be1..ea44671a45b5 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 000000000000..dde637225ad7 --- /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 000000000000..070e4ff7f75d --- /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 000000000000..9f31ec31a12a --- /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 58a4ecb3e499..000000000000 --- 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 e81ae64ffb41..000000000000 --- 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/src/Generated/Extensions/ContainerInstanceExtensions.cs b/sdk/containerinstance/Azure.ResourceManager.ContainerInstance/src/Generated/Extensions/ContainerInstanceExtensions.cs index d7f98c32b253..ff1d19941f74 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 000000000000..dfa2a837653c --- /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 000000000000..cc22c55005eb --- /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 000000000000..190035cd946a --- /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 84866a644970..000000000000 --- 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 7f606abe1019..000000000000 --- 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/src/Generated/ContainerRegistryResource.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryResource.cs index 0e90367aab1b..b4f8bd39fc23 100644 --- a/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryResource.cs +++ b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/ContainerRegistryResource.cs @@ -102,7 +102,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 +120,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 +143,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 +155,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 +173,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 +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 GetContainerRegistryPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { @@ -208,7 +208,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 +226,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 +249,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 +261,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 +279,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 +302,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 +314,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 +332,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 +355,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 +367,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 +385,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 +408,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 +420,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 +438,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 +461,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 +473,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 +491,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 +514,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 +526,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 +544,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 +567,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 +579,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 +597,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 +620,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/Extensions/ContainerRegistryExtensions.cs b/sdk/containerregistry/Azure.ResourceManager.ContainerRegistry/src/Generated/Extensions/ContainerRegistryExtensions.cs index ffdba75144ee..196974fc56d3 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 000000000000..0feaf29515cd --- /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 000000000000..630c64028d22 --- /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 000000000000..85c327d5c62d --- /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 d33b5d4a11ee..000000000000 --- 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 027fb12f1d78..000000000000 --- 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/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetResource.cs index 64b183413ec1..ac32b30c3dc9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceFleetResource.cs @@ -93,7 +93,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 +111,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 +134,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/ContainerServiceManagedClusterResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs index 14d1ee5b623c..8c04b3b25c7d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs @@ -113,7 +113,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 +131,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 +154,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 +166,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 +184,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 +207,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 +219,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 +237,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 +260,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 +272,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 +290,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 +313,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/Extensions/ContainerServiceExtensions.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs index 134eff41d3c6..26d47abd7e16 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 000000000000..c32dc1efc3f8 --- /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 000000000000..11b8e5ca495e --- /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 000000000000..2e78b288bddc --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceSubscriptionResource.cs @@ -0,0 +1,291 @@ +// 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 an object representing a OSOptionProfileResource along with the instance operations that can be performed on it in the SubscriptionResource. + /// Returns a object. + public virtual OSOptionProfileResource GetOSOptionProfile() + { + return new OSOptionProfileResource(Client, Id.AppendChildResource("osOptions", "default")); + } + + /// + /// 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 8ac7a7df2f7d..000000000000 --- 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 00ff449ba0c8..000000000000 --- 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/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterResource.cs index 3c08d622e83c..9def9f93de8a 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraClusterResource.cs @@ -93,7 +93,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// An object representing collection of CassandraClusterBackupResources and their operations over a CassandraClusterBackupResource. public virtual CassandraClusterBackupResourceCollection GetCassandraClusterBackupResources() { - return GetCachedClient(Client => new CassandraClusterBackupResourceCollection(Client, Id)); + return GetCachedClient(client => new CassandraClusterBackupResourceCollection(client, Id)); } /// @@ -111,8 +111,8 @@ public virtual CassandraClusterBackupResourceCollection GetCassandraClusterBacku /// /// 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. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual async Task> GetCassandraClusterBackupResourceAsync(string backupId, CancellationToken cancellationToken = default) { @@ -134,8 +134,8 @@ public virtual async Task> GetCassandra /// /// 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. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] public virtual Response GetCassandraClusterBackupResource(string backupId, CancellationToken cancellationToken = default) { @@ -146,7 +146,7 @@ public virtual Response GetCassandraClusterBacku /// 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 +164,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 +187,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) { diff --git a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceResource.cs index c21c4e04cd1d..524cf0dfeb48 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CassandraKeyspaceResource.cs @@ -99,7 +99,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 +117,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 +140,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 +152,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 +170,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 +193,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/CosmosDBAccountResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountResource.cs index 3a1688bc2bb5..e3dab0eb0e13 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBAccountResource.cs @@ -138,7 +138,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 +156,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 +179,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 +191,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 +209,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 +232,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 +244,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 +262,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 +285,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 +297,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 +315,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 +338,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 +350,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 +368,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 +391,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 +403,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 +421,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 +444,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 +456,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 +474,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 +497,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 +509,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 +527,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 +550,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 +562,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 +580,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 +603,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 +615,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 +633,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 +656,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 +668,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 +686,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 +709,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 +721,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 +739,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 +762,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 +774,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 +792,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 +815,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 +827,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 +845,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 +868,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/CosmosDBLocationResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationResource.cs index 7dd363e107a0..6ce8ce3f59fb 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBLocationResource.cs @@ -96,7 +96,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/CosmosDBSqlContainerResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerResource.cs index 9f0adfe24022..e465179ec895 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlContainerResource.cs @@ -99,7 +99,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 +117,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 +140,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 +152,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 +170,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 +193,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 +205,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 +223,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 +246,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/CosmosDBSqlDatabaseResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseResource.cs index 76c3613af7c8..5325c4b42841 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/CosmosDBSqlDatabaseResource.cs @@ -99,7 +99,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 +117,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 +140,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 +152,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 +170,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 +193,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/Extensions/CosmosDBExtensions.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/CosmosDBExtensions.cs index b1a35e4957e0..32235307732f 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,694 @@ 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. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// 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); - } - ); + return GetMockableCosmosDBArmClient(client).GetCassandraClusterBackupResource(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 +721,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 +749,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 +791,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 +819,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 +861,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 +889,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 +931,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 +942,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 +957,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 +968,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 +983,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 +1008,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 +1033,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 +1058,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 +1083,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 +1108,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 +1133,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 +1158,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 +1183,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 +1195,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 +1210,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 +1222,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 000000000000..8d04cefc9ef2 --- /dev/null +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/Extensions/MockableCosmosDBArmClient.cs @@ -0,0 +1,531 @@ +// 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 CassandraClusterBackupResource GetCassandraClusterBackupResource(ResourceIdentifier id) + { + CassandraClusterBackupResource.ValidateResourceId(id); + return new CassandraClusterBackupResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with 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 000000000000..255d57b83264 --- /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 000000000000..13fa9adfee27 --- /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 000000000000..25db51aefc2c --- /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 16288351d958..000000000000 --- 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 045361201fde..000000000000 --- 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 30e33cc48028..000000000000 --- 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/GremlinDatabaseResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseResource.cs index 2bdd4c627dc8..678226732b76 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/GremlinDatabaseResource.cs @@ -99,7 +99,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 +117,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 +140,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/MongoClusterResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterResource.cs index 7bf5d3b850b6..0e59957f973b 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoClusterResource.cs @@ -93,7 +93,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 +111,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 +134,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/MongoDBDatabaseResource.cs b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseResource.cs index adefa62d6d68..40ea72971a32 100644 --- a/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseResource.cs +++ b/sdk/cosmosdb/Azure.ResourceManager.CosmosDB/src/Generated/MongoDBDatabaseResource.cs @@ -99,7 +99,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 +117,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 +140,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/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterResource.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterResource.cs index 6463b494de51..2eb00df7e43f 100644 --- a/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterResource.cs +++ b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/CosmosDBForPostgreSqlClusterResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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 +305,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 +323,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 +346,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 +358,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 +376,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 +399,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 +411,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 +429,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 +452,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 +464,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 +482,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 +505,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/Extensions/CosmosDBForPostgreSqlExtensions.cs b/sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql/src/Generated/Extensions/CosmosDBForPostgreSqlExtensions.cs index 4b3c0e12c5f1..f34b1938e459 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 000000000000..1db6c5efcbca --- /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 000000000000..55e4a9dfb778 --- /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 000000000000..c0ab65b02f7b --- /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 b253817e3d4b..000000000000 --- 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 3f97299bef20..000000000000 --- 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/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/costmanagement/Azure.ResourceManager.CostManagement/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index 95011d0e1e1c..000000000000 --- 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 ba58d05238a8..85803ab52f8b 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 000000000000..5bc77bc448b8 --- /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 000000000000..a1f885cc2125 --- /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 19274737033d..000000000000 --- 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/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatResource.cs b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatResource.cs index ee2355f1a90c..e20788062ea7 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/ConnectorResourceFormatResource.cs @@ -90,7 +90,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 +108,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 +131,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 a500d3fc3bab..2e34ebfcd612 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 000000000000..e290845f7a06 --- /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 000000000000..b01f21d65578 --- /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 000000000000..3845eeca6f84 --- /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 4e2892bedf55..000000000000 --- 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 86b7a5a888b7..000000000000 --- 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 534422bf9cd4..3b9d8c3a0e99 100644 --- a/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubResource.cs +++ b/sdk/customer-insights/Azure.ResourceManager.CustomerInsights/src/Generated/HubResource.cs @@ -102,7 +102,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 +121,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 +145,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 +157,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 +176,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 +200,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 +212,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 +230,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 +253,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 +265,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 +283,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 +306,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 +318,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 +336,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 +359,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 +371,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 +389,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 +412,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 +424,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 +442,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 +465,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 +477,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 +495,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 +518,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 +530,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 +549,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 +573,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 +585,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 +603,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 +626,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 +638,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 +656,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 +679,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 +691,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 +709,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 +732,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/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/DataBoxExtensions.cs b/sdk/databox/Azure.ResourceManager.DataBox/src/Generated/Extensions/DataBoxExtensions.cs index e14c3f81fb13..56fbcbdb0da7 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 000000000000..d9a79b51687a --- /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 000000000000..bed02e356c5e --- /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 000000000000..7d1abe461193 --- /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 b3bb2577ac18..000000000000 --- 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 a0a972d78467..000000000000 --- 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/src/Generated/DataBoxEdgeDeviceResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceResource.cs index 1f2d3a808992..d59f58765ae8 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeDeviceResource.cs @@ -110,7 +110,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 +128,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 +151,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 +163,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 +181,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 +204,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 +230,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 +248,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 +271,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 +290,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 +308,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 +331,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 +343,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 +361,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 +384,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 +396,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 +414,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 +437,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 +449,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 +467,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 +490,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 +502,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 +520,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 +543,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 +555,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 +573,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 +596,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/DataBoxEdgeRoleResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleResource.cs index 7b69e6271bbd..76a99a129121 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeRoleResource.cs @@ -90,7 +90,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 +108,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 +131,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/DataBoxEdgeStorageAccountResource.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountResource.cs index a32f56794a5a..1f9c5553a924 100644 --- a/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountResource.cs +++ b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/DataBoxEdgeStorageAccountResource.cs @@ -90,7 +90,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 +108,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 +131,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/Extensions/DataBoxEdgeExtensions.cs b/sdk/databoxedge/Azure.ResourceManager.DataBoxEdge/src/Generated/Extensions/DataBoxEdgeExtensions.cs index 6a56a0b9553f..6d4aefebeec7 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 000000000000..aca910437d19 --- /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 000000000000..4dd52f8aaed7 --- /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 000000000000..3abcfa025e13 --- /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 339de49f050e..000000000000 --- 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 46c4ea7a5d1a..000000000000 --- 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/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResource.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResource.cs index af5992f12a29..57ff330c1eba 100644 --- a/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResource.cs +++ b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/DatadogMonitorResource.cs @@ -96,7 +96,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 +114,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 +137,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 +149,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 +167,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 +190,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/Extensions/DatadogExtensions.cs b/sdk/datadog/Azure.ResourceManager.Datadog/src/Generated/Extensions/DatadogExtensions.cs index e82e409d3385..491b24f85768 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 000000000000..3fb105a910f6 --- /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 000000000000..4b85cb661797 --- /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 000000000000..33af002a1e5e --- /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 a928814494d5..000000000000 --- 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 f9440815f165..000000000000 --- 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/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkResource.cs index b901315d94b0..6079e302b2c1 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryManagedVirtualNetworkResource.cs @@ -90,7 +90,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 +109,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 +133,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/DataFactoryResource.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryResource.cs index 54a373e150cb..2bdfcaff3126 100644 --- a/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryResource.cs +++ b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/DataFactoryResource.cs @@ -123,7 +123,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 +142,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 +166,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 +178,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 +197,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 +221,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 +233,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 +252,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 +276,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 +288,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 +307,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 +331,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 +343,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 +362,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 +386,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 +398,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 +417,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 +441,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 +453,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 +472,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 +496,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 +508,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 +527,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 +551,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 +563,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 +582,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 +606,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 +618,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 +636,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 +659,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 +671,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 +690,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 +714,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/Extensions/DataFactoryExtensions.cs b/sdk/datafactory/Azure.ResourceManager.DataFactory/src/Generated/Extensions/DataFactoryExtensions.cs index 40984d0ff8c9..fa093338c154 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 000000000000..b01040efabbd --- /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 000000000000..b7fedf8c8b7b --- /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 000000000000..78f3ca100a52 --- /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 d9090efdae84..000000000000 --- 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 5bc6c11b361e..000000000000 --- 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/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsAccountResource.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsAccountResource.cs index aea955c5c60a..6ff188cb86ef 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsAccountResource.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsAccountResource.cs @@ -92,7 +92,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 +110,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 +133,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 +145,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 +163,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 +186,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 +198,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 +216,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 +239,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 +251,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 +269,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 +292,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/DataLakeAnalyticsStorageAccountInformationResource.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageAccountInformationResource.cs index 0125c0dd95a9..08808e8e5a34 100644 --- a/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageAccountInformationResource.cs +++ b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/DataLakeAnalyticsStorageAccountInformationResource.cs @@ -91,7 +91,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 +109,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 +132,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/Extensions/DataLakeAnalyticsExtensions.cs b/sdk/datalake-analytics/Azure.ResourceManager.DataLakeAnalytics/src/Generated/Extensions/DataLakeAnalyticsExtensions.cs index 5c69bccdd82c..bec8d3887809 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 000000000000..8c1b0e050d33 --- /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 000000000000..ae8f835052a0 --- /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 000000000000..6445d3743ed4 --- /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 7e666d930b83..000000000000 --- 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 b69ade11f79f..000000000000 --- 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/src/Generated/DataLakeStoreAccountResource.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreAccountResource.cs index 17590d25ce64..51be43d6afa6 100644 --- a/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreAccountResource.cs +++ b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/DataLakeStoreAccountResource.cs @@ -92,7 +92,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 +110,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 +133,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 +145,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 +163,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 +186,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 +198,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 +216,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 +239,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/Extensions/DataLakeStoreExtensions.cs b/sdk/datalake-store/Azure.ResourceManager.DataLakeStore/src/Generated/Extensions/DataLakeStoreExtensions.cs index fd3244939321..3b4e024213f0 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 000000000000..786a35b6dae0 --- /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 000000000000..08d16930ebc1 --- /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 000000000000..35cde6ddcbd1 --- /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 3690c2ade852..000000000000 --- 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 bcb106d3a4fa..000000000000 --- 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/src/Generated/DataMigrationServiceResource.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DataMigrationServiceResource.cs index 3cf06e017eef..df734afe33e4 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DataMigrationServiceResource.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/DataMigrationServiceResource.cs @@ -94,7 +94,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 +113,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 +137,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 +149,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 +167,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 +190,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/Extensions/DataMigrationExtensions.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/Extensions/DataMigrationExtensions.cs index d86dcd38a6af..2a68380bc657 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 000000000000..d59403480109 --- /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 000000000000..a0e2c63ff922 --- /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 000000000000..fbda8a267ac0 --- /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 3c2da0686859..000000000000 --- 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 a017b0c3ea15..000000000000 --- 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/ProjectResource.cs b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectResource.cs index 1ffe878c53d7..1f7902a8587b 100644 --- a/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectResource.cs +++ b/sdk/datamigration/Azure.ResourceManager.DataMigration/src/Generated/ProjectResource.cs @@ -91,7 +91,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 +110,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 +134,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 +146,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 +164,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 +187,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/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupInstanceResource.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupInstanceResource.cs index 33c6a4d84c08..dbe5f1fce8a8 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupInstanceResource.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupInstanceResource.cs @@ -96,7 +96,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 +114,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 +137,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/DataProtectionBackupVaultResource.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupVaultResource.cs index 90deae40c850..b728f3842502 100644 --- a/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupVaultResource.cs +++ b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/DataProtectionBackupVaultResource.cs @@ -102,7 +102,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 +120,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 +143,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 +155,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 +173,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 +196,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 +208,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 +226,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 +249,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 +261,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 +279,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 +302,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 +314,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 +332,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 +355,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/Extensions/DataProtectionBackupExtensions.cs b/sdk/dataprotection/Azure.ResourceManager.DataProtectionBackup/src/Generated/Extensions/DataProtectionBackupExtensions.cs index cc6d533895be..fa67cbd82892 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 000000000000..055b308f429b --- /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 000000000000..9c12b4c97006 --- /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 000000000000..52145e6147af --- /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 cfc7042c4859..000000000000 --- 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 27ccc29ea03b..000000000000 --- 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/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareAccountResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareAccountResource.cs index bea9a8a26a2e..2197dc81a559 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareAccountResource.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareAccountResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/DataShareResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareResource.cs index c73cb2f8861a..4c6ed2e02b67 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareResource.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/DataShareResource.cs @@ -92,7 +92,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 +110,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 +133,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 +145,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 +163,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 +186,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 +198,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 +216,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 +239,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 +251,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 +269,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 +292,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/Extensions/DataShareExtensions.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/Extensions/DataShareExtensions.cs index 4f17bdec8c0d..68b0e13fc534 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 000000000000..8248b2b7dbe7 --- /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 000000000000..7f2ff365664f --- /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 000000000000..5a3859f09d1b --- /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 000000000000..9c6346df01f3 --- /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 d1f59a01040b..000000000000 --- 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 657653087537..000000000000 --- 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 60b4a9c74b2b..000000000000 --- 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/ShareSubscriptionResource.cs b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareSubscriptionResource.cs index 53c1bc93b63e..61a21d156eb3 100644 --- a/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareSubscriptionResource.cs +++ b/sdk/datashare/Azure.ResourceManager.DataShare/src/Generated/ShareSubscriptionResource.cs @@ -96,7 +96,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 +114,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 +137,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 +149,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 +167,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 +190,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/src/Generated/EasmWorkspaceResource.cs b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmWorkspaceResource.cs index 46a0b1840f73..1d2ee74e5a52 100644 --- a/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmWorkspaceResource.cs +++ b/sdk/defendereasm/Azure.ResourceManager.DefenderEasm/src/Generated/EasmWorkspaceResource.cs @@ -97,7 +97,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 +115,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 +138,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 2e26600dfdfe..adc1dbbbf2ae 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 000000000000..fe12ab93867f --- /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 000000000000..5fe0630af8f0 --- /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 000000000000..b4bc5d78c504 --- /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 e172ba5fcb67..000000000000 --- 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 b288af25e4c2..000000000000 --- 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/src/Generated/Extensions/DesktopVirtualizationExtensions.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/DesktopVirtualizationExtensions.cs index 484836e61f8f..6f87dd941a77 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,233 +19,193 @@ 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 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 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(); } /// @@ -259,16 +220,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); } /// @@ -283,24 +248,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(); } /// @@ -315,16 +290,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); } /// @@ -339,24 +318,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(); } /// @@ -371,16 +360,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); } /// @@ -395,24 +388,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(); } /// @@ -427,16 +430,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); } /// @@ -451,16 +458,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); } /// @@ -475,13 +486,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); } /// @@ -496,13 +511,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); } /// @@ -517,6 +536,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. @@ -526,7 +549,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); } /// @@ -541,6 +564,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. @@ -550,7 +577,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); } /// @@ -565,6 +592,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. @@ -572,7 +603,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); } /// @@ -587,6 +618,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. @@ -594,7 +629,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); } /// @@ -609,6 +644,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. @@ -618,7 +657,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); } /// @@ -633,6 +672,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. @@ -642,7 +685,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 000000000000..f58cca1242ae --- /dev/null +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/Extensions/MockableDesktopVirtualizationArmClient.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.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 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 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 000000000000..68385dc4e712 --- /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 000000000000..3c7f7d5f9f3e --- /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 4e2fd4f11d15..000000000000 --- 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 33906259f0a3..000000000000 --- 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/HostPoolResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolResource.cs index 9808b2c014d7..1eadb593462b 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/HostPoolResource.cs @@ -108,7 +108,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// 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)); } /// @@ -126,8 +126,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) { @@ -149,8 +149,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) { @@ -161,7 +161,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)); } /// @@ -179,8 +179,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) { @@ -202,8 +202,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/ScalingPlanResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanResource.cs index 9aca0601777d..b5fce706535d 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/ScalingPlanResource.cs @@ -93,7 +93,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 +111,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 +134,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) { diff --git a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs index 89ae0e6a7d26..b9983be896a4 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/SessionHostResource.cs @@ -91,7 +91,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 +109,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 +132,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/VirtualApplicationGroupResource.cs b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupResource.cs index fb9cfe82a48f..25bf6914f231 100644 --- a/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupResource.cs +++ b/sdk/desktopvirtualization/Azure.ResourceManager.DesktopVirtualization/src/Generated/VirtualApplicationGroupResource.cs @@ -98,7 +98,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 +116,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 +139,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 +151,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 +169,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 +192,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/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterGalleryResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterGalleryResource.cs index 68c695e58b9e..80ceef8fabc3 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterGalleryResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterGalleryResource.cs @@ -90,7 +90,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 +108,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 +131,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 6124349c5e12..68385554e8ba 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterImageResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterImageResource.cs @@ -90,7 +90,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 +108,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 +131,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/DevCenterPoolResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterPoolResource.cs index 4eeb08bea34f..9363f4bd5139 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterPoolResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterPoolResource.cs @@ -92,7 +92,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 +111,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 +135,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/DevCenterProjectResource.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectResource.cs index 44b0eada425d..1fbbeb80f2d2 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterProjectResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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 +305,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 +323,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 +346,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 5d9b793d3bc8..7835d3a4defa 100644 --- a/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterResource.cs +++ b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/DevCenterResource.cs @@ -99,7 +99,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 +117,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 +140,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 +152,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 +170,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 +193,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 +205,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 +223,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 +246,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 +258,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 +276,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 +299,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 +311,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 +329,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 +352,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/Extensions/DevCenterExtensions.cs b/sdk/devcenter/Azure.ResourceManager.DevCenter/src/Generated/Extensions/DevCenterExtensions.cs index d12b5fb44904..63d62ecb47e3 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 000000000000..2efdaad1bd7a --- /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 000000000000..3cec3c91e278 --- /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 000000000000..98318e45cc83 --- /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 0bb4b529cc26..000000000000 --- 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 817beb45dc0b..000000000000 --- 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/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServiceResource.cs b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServiceResource.cs index 34fbfe674902..6df96443cb88 100644 --- a/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServiceResource.cs +++ b/sdk/deviceprovisioningservices/Azure.ResourceManager.DeviceProvisioningServices/src/Generated/DeviceProvisioningServiceResource.cs @@ -94,7 +94,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 +113,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 +137,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 +149,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 +167,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 +190,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 +202,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 +220,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 +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 GetDeviceProvisioningServicesPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) { 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 68c9a1fa75b4..b42948a197fa 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 000000000000..c26fb463e200 --- /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 000000000000..652117eb56ab --- /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 000000000000..5925709c3a09 --- /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 1edaa3a07901..000000000000 --- 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 b4f5af9fcacf..000000000000 --- 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/src/Generated/DeviceUpdateAccountResource.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateAccountResource.cs index 5a749c13bdd2..bcc0835ed762 100644 --- a/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateAccountResource.cs +++ b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/DeviceUpdateAccountResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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/Extensions/DeviceUpdateExtensions.cs b/sdk/deviceupdate/Azure.ResourceManager.DeviceUpdate/src/Generated/Extensions/DeviceUpdateExtensions.cs index 95187897d187..84a25d074ba2 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 000000000000..d51d82fd12d2 --- /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 000000000000..19bdd2437a3e --- /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 000000000000..9a064988379a --- /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 366e738c273b..000000000000 --- 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 cbbd0011167c..000000000000 --- 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/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/DevSpacesExtensions.cs b/sdk/devspaces/Azure.ResourceManager.DevSpaces/src/Generated/Extensions/DevSpacesExtensions.cs index 9ecbb6892987..7c2d33b7c977 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 000000000000..fb51ab26bafa --- /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 000000000000..bb040fb870d7 --- /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 000000000000..d5d3d69d5466 --- /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 cc1f48334525..000000000000 --- 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 487d2aad736a..000000000000 --- 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/src/Generated/DevTestLabArtifactSourceResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceResource.cs index 4f9320fdb56b..2899020c684b 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabArtifactSourceResource.cs @@ -92,7 +92,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 +111,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 +135,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 +147,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 +166,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 +190,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/DevTestLabResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabResource.cs index f24fee4f6b0c..012cae05dfe0 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabResource.cs @@ -104,7 +104,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 +123,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 +147,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 +159,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 +178,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 +202,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 +214,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 +233,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 +257,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 +269,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 +288,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 +312,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 +324,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 +343,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 +367,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 +379,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 +398,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 +422,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 +432,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 +457,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 +482,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 +494,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 +512,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 +535,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 +547,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 +566,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 +590,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 +602,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 +621,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 +645,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 +657,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 +676,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 +700,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/DevTestLabServiceFabricResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricResource.cs index 1a46550c5bb2..fcc171228515 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabServiceFabricResource.cs @@ -92,7 +92,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 +111,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 +135,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/DevTestLabUserResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserResource.cs index ffa5fdffee21..5d4143949753 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabUserResource.cs @@ -92,7 +92,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 +111,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 +135,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 +147,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 +166,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 +190,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 +202,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 +221,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 +245,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 +257,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 +276,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 +300,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/DevTestLabVmResource.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmResource.cs index 972b43eff03f..83636ce9f879 100644 --- a/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmResource.cs +++ b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/DevTestLabVmResource.cs @@ -92,7 +92,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 +111,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 +135,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/Extensions/DevTestLabsExtensions.cs b/sdk/devtestlabs/Azure.ResourceManager.DevTestLabs/src/Generated/Extensions/DevTestLabsExtensions.cs index 8f3189b14004..3da61568c9ea 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 000000000000..79d39f50b687 --- /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 000000000000..f508ac9a6d5a --- /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 000000000000..b6d3ea65643b --- /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 c15281e9a375..000000000000 --- 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 1f37b3222ddd..000000000000 --- 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/src/Generated/DigitalTwinsDescriptionResource.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsDescriptionResource.cs index 460f5785ffa6..7383a659ebe9 100644 --- a/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsDescriptionResource.cs +++ b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/DigitalTwinsDescriptionResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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/Extensions/DigitalTwinsExtensions.cs b/sdk/digitaltwins/Azure.ResourceManager.DigitalTwins/src/Generated/Extensions/DigitalTwinsExtensions.cs index 6cdbd7f2d23d..9c989defdb2c 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 000000000000..aeff340a5e8b --- /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 000000000000..68964601a9fd --- /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 000000000000..bf945c0678cf --- /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 d59779ea0d8d..000000000000 --- 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 ed8a7b0e1d7a..000000000000 --- 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/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/DnsExtensions.cs b/sdk/dns/Azure.ResourceManager.Dns/src/Generated/Extensions/DnsExtensions.cs index e4ad455c51ee..59a8dd2d8de8 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 000000000000..33b8c0372428 --- /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 000000000000..13ef12dfaf02 --- /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 000000000000..c9d8aadefbdf --- /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 0750fe110607..000000000000 --- 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 d0dd4976fa5a..000000000000 --- 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/src/Generated/DnsForwardingRulesetResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetResource.cs index 7de343f46110..7f3df8e1de13 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsForwardingRulesetResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/DnsResolverResource.cs b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverResource.cs index fa4b7e1d1fb2..31f62d666327 100644 --- a/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverResource.cs +++ b/sdk/dnsresolver/Azure.ResourceManager.DnsResolver/src/Generated/DnsResolverResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 1a9ab38a65a2..38d426d0ae43 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 000000000000..afd912c9b3f7 --- /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 000000000000..c74d0f58e808 --- /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 000000000000..d1339e0add3d --- /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 e0ea8a2b99f3..000000000000 --- 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 e0bf4b74acbc..000000000000 --- 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/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceMonitorResource.cs b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceMonitorResource.cs index f381dfc109d4..9fa3e19d721c 100644 --- a/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceMonitorResource.cs +++ b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/DynatraceMonitorResource.cs @@ -94,7 +94,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 +112,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 +135,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 +147,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 +165,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 +188,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/Extensions/DynatraceExtensions.cs b/sdk/dynatrace/Azure.ResourceManager.Dynatrace/src/Generated/Extensions/DynatraceExtensions.cs index 99b1769090d9..502d21599f04 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 000000000000..71cb35574aff --- /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 000000000000..42f6131f98cf --- /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 000000000000..56a5bc210884 --- /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 604a09c292bd..000000000000 --- 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 217284f0d0c3..000000000000 --- 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/src/Generated/Extensions/EdgeOrderExtensions.cs b/sdk/edgeorder/Azure.ResourceManager.EdgeOrder/src/Generated/Extensions/EdgeOrderExtensions.cs index 131b6cf1c107..a0125f512ec0 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 000000000000..9052b1fb850f --- /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 000000000000..95023e3702dc --- /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 000000000000..9be2f86af7a0 --- /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 9373009ee72a..000000000000 --- 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 5eb27a9b0c10..000000000000 --- 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/src/Generated/ElasticMonitorResource.cs b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResource.cs index 705816e3b2f4..9967f283c586 100644 --- a/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResource.cs +++ b/sdk/elastic/Azure.ResourceManager.Elastic/src/Generated/ElasticMonitorResource.cs @@ -114,7 +114,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 +132,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 +155,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 23a67ac78a0f..b059b98fd8ff 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 000000000000..9d69924547d9 --- /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 000000000000..c93a2835dff8 --- /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 000000000000..2454b4abb065 --- /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 8ce3859d9bb5..000000000000 --- 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 86cb1b328824..000000000000 --- 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/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanResource.cs index 9ec016d99383..04282a525f60 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanResource.cs @@ -98,7 +98,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 +116,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 +139,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 +151,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 +169,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 +192,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/ElasticSanVolumeGroupResource.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.cs index 1777fb05476c..bbc57b732aea 100644 --- a/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.cs +++ b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/ElasticSanVolumeGroupResource.cs @@ -91,7 +91,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 +109,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 +132,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 +144,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 +162,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 +185,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/Extensions/ElasticSanExtensions.cs b/sdk/elasticsan/Azure.ResourceManager.ElasticSan/src/Generated/Extensions/ElasticSanExtensions.cs index 69b72688e23b..67d72a7ff6d6 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 000000000000..cb0dbfa1fab3 --- /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 000000000000..310a99f3df47 --- /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 000000000000..158c2f810ae7 --- /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 10400472451d..000000000000 --- 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 8e6e781a5fcd..000000000000 --- 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/src/Generated/DomainTopicResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicResource.cs index a11dd0bbc5fa..0df7d37c8bd2 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/DomainTopicResource.cs @@ -90,7 +90,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 +108,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 +131,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/EventGridDomainResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainResource.cs index 58992f129f9d..0ee1e2eb7bb4 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridDomainResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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/EventGridNamespaceResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceResource.cs index 0638e189d5f4..f6c4794e363b 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridNamespaceResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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 +305,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 +323,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 +346,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 +358,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 +376,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 +399,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/EventGridTopicResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicResource.cs index 674b176eb7dc..af919068270a 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/EventGridTopicResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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/Extensions/ArmResourceExtensionClient.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index c8a1b5fefc0c..000000000000 --- 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 80f463ceac09..ee55b8c50d08 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 000000000000..8c80fffef35b --- /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 000000000000..9f3356731d02 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/MockableEventGridResourceGroupResource.cs @@ -0,0 +1,711 @@ +// 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); + } + + /// + /// 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. + /// 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 GetGlobalEventSubscriptionsDataForTopicTypeAsync(string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => EventSubscriptionRestClient.CreateListGlobalByResourceGroupForTopicTypeRequest(Id.SubscriptionId, Id.ResourceGroupName, topicTypeName, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventSubscriptionRestClient.CreateListGlobalByResourceGroupForTopicTypeNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, topicTypeName, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventSubscriptionResource(Client, EventGridSubscriptionData.DeserializeEventGridSubscriptionData(e)), EventSubscriptionClientDiagnostics, Pipeline, "MockableEventGridResourceGroupResource.GetGlobalEventSubscriptionsDataForTopicType", "value", "nextLink", cancellationToken); + } + + /// + /// 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. + /// 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 GetGlobalEventSubscriptionsDataForTopicType(string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => EventSubscriptionRestClient.CreateListGlobalByResourceGroupForTopicTypeRequest(Id.SubscriptionId, Id.ResourceGroupName, topicTypeName, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventSubscriptionRestClient.CreateListGlobalByResourceGroupForTopicTypeNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, topicTypeName, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventSubscriptionResource(Client, EventGridSubscriptionData.DeserializeEventGridSubscriptionData(e)), EventSubscriptionClientDiagnostics, Pipeline, "MockableEventGridResourceGroupResource.GetGlobalEventSubscriptionsDataForTopicType", "value", "nextLink", cancellationToken); + } + + /// + /// 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) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventSubscriptionRestClient.CreateListRegionalByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventSubscriptionRestClient.CreateListRegionalByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventSubscriptionResource(Client, EventGridSubscriptionData.DeserializeEventGridSubscriptionData(e)), EventSubscriptionClientDiagnostics, Pipeline, "MockableEventGridResourceGroupResource.GetRegionalEventSubscriptionsData", "value", "nextLink", cancellationToken); + } + + /// + /// 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) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventSubscriptionRestClient.CreateListRegionalByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName, location, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventSubscriptionRestClient.CreateListRegionalByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventSubscriptionResource(Client, EventGridSubscriptionData.DeserializeEventGridSubscriptionData(e)), EventSubscriptionClientDiagnostics, Pipeline, "MockableEventGridResourceGroupResource.GetRegionalEventSubscriptionsData", "value", "nextLink", cancellationToken); + } + + /// + /// 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. + /// 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 GetRegionalEventSubscriptionsDataForTopicTypeAsync(AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => EventSubscriptionRestClient.CreateListRegionalByResourceGroupForTopicTypeRequest(Id.SubscriptionId, Id.ResourceGroupName, location, topicTypeName, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventSubscriptionRestClient.CreateListRegionalByResourceGroupForTopicTypeNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, topicTypeName, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventSubscriptionResource(Client, EventGridSubscriptionData.DeserializeEventGridSubscriptionData(e)), EventSubscriptionClientDiagnostics, Pipeline, "MockableEventGridResourceGroupResource.GetRegionalEventSubscriptionsDataForTopicType", "value", "nextLink", cancellationToken); + } + + /// + /// 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. + /// 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 GetRegionalEventSubscriptionsDataForTopicType(AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => EventSubscriptionRestClient.CreateListRegionalByResourceGroupForTopicTypeRequest(Id.SubscriptionId, Id.ResourceGroupName, location, topicTypeName, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventSubscriptionRestClient.CreateListRegionalByResourceGroupForTopicTypeNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, location, topicTypeName, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventSubscriptionResource(Client, EventGridSubscriptionData.DeserializeEventGridSubscriptionData(e)), EventSubscriptionClientDiagnostics, Pipeline, "MockableEventGridResourceGroupResource.GetRegionalEventSubscriptionsDataForTopicType", "value", "nextLink", 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. + /// , 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 GetEventTypesAsync(string providerNamespace, string resourceTypeName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerNamespace, nameof(providerNamespace)); + Argument.AssertNotNullOrEmpty(resourceTypeName, nameof(resourceTypeName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridTopicTopicsRestClient.CreateListEventTypesRequest(Id.SubscriptionId, Id.ResourceGroupName, providerNamespace, resourceTypeName, resourceName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, EventTypeUnderTopic.DeserializeEventTypeUnderTopic, EventGridTopicTopicsClientDiagnostics, Pipeline, "MockableEventGridResourceGroupResource.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. + /// , 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 GetEventTypes(string providerNamespace, string resourceTypeName, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerNamespace, nameof(providerNamespace)); + Argument.AssertNotNullOrEmpty(resourceTypeName, nameof(resourceTypeName)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => EventGridTopicTopicsRestClient.CreateListEventTypesRequest(Id.SubscriptionId, Id.ResourceGroupName, providerNamespace, resourceTypeName, resourceName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, EventTypeUnderTopic.DeserializeEventTypeUnderTopic, EventGridTopicTopicsClientDiagnostics, Pipeline, "MockableEventGridResourceGroupResource.GetEventTypes", "value", null, 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 000000000000..7d9c02d58796 --- /dev/null +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/Extensions/MockableEventGridSubscriptionResource.cs @@ -0,0 +1,682 @@ +// 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 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. + /// 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 GetGlobalEventSubscriptionsDataForTopicTypeAsync(string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => EventSubscriptionRestClient.CreateListGlobalBySubscriptionForTopicTypeRequest(Id.SubscriptionId, topicTypeName, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventSubscriptionRestClient.CreateListGlobalBySubscriptionForTopicTypeNextPageRequest(nextLink, Id.SubscriptionId, topicTypeName, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventSubscriptionResource(Client, EventGridSubscriptionData.DeserializeEventGridSubscriptionData(e)), EventSubscriptionClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetGlobalEventSubscriptionsDataForTopicType", "value", "nextLink", cancellationToken); + } + + /// + /// 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. + /// 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 GetGlobalEventSubscriptionsDataForTopicType(string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => EventSubscriptionRestClient.CreateListGlobalBySubscriptionForTopicTypeRequest(Id.SubscriptionId, topicTypeName, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventSubscriptionRestClient.CreateListGlobalBySubscriptionForTopicTypeNextPageRequest(nextLink, Id.SubscriptionId, topicTypeName, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventSubscriptionResource(Client, EventGridSubscriptionData.DeserializeEventGridSubscriptionData(e)), EventSubscriptionClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetGlobalEventSubscriptionsDataForTopicType", "value", "nextLink", cancellationToken); + } + + /// + /// 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) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventSubscriptionRestClient.CreateListRegionalBySubscriptionRequest(Id.SubscriptionId, location, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventSubscriptionRestClient.CreateListRegionalBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, location, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventSubscriptionResource(Client, EventGridSubscriptionData.DeserializeEventGridSubscriptionData(e)), EventSubscriptionClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetRegionalEventSubscriptionsData", "value", "nextLink", cancellationToken); + } + + /// + /// 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) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EventSubscriptionRestClient.CreateListRegionalBySubscriptionRequest(Id.SubscriptionId, location, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventSubscriptionRestClient.CreateListRegionalBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, location, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventSubscriptionResource(Client, EventGridSubscriptionData.DeserializeEventGridSubscriptionData(e)), EventSubscriptionClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetRegionalEventSubscriptionsData", "value", "nextLink", cancellationToken); + } + + /// + /// 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. + /// 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 GetRegionalEventSubscriptionsDataForTopicTypeAsync(AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => EventSubscriptionRestClient.CreateListRegionalBySubscriptionForTopicTypeRequest(Id.SubscriptionId, location, topicTypeName, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventSubscriptionRestClient.CreateListRegionalBySubscriptionForTopicTypeNextPageRequest(nextLink, Id.SubscriptionId, location, topicTypeName, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EventSubscriptionResource(Client, EventGridSubscriptionData.DeserializeEventGridSubscriptionData(e)), EventSubscriptionClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetRegionalEventSubscriptionsDataForTopicType", "value", "nextLink", cancellationToken); + } + + /// + /// 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. + /// 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 GetRegionalEventSubscriptionsDataForTopicType(AzureLocation location, string topicTypeName, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(topicTypeName, nameof(topicTypeName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => EventSubscriptionRestClient.CreateListRegionalBySubscriptionForTopicTypeRequest(Id.SubscriptionId, location, topicTypeName, filter, top); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EventSubscriptionRestClient.CreateListRegionalBySubscriptionForTopicTypeNextPageRequest(nextLink, Id.SubscriptionId, location, topicTypeName, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EventSubscriptionResource(Client, EventGridSubscriptionData.DeserializeEventGridSubscriptionData(e)), EventSubscriptionClientDiagnostics, Pipeline, "MockableEventGridSubscriptionResource.GetRegionalEventSubscriptionsDataForTopicType", "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 000000000000..412e236e9dfb --- /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 6fd2b6076b4f..000000000000 --- 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 34a12c90d428..000000000000 --- 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 0b72cd7670e0..000000000000 --- 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/NamespaceTopicResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicResource.cs index 62016a795781..254fb37e238c 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/NamespaceTopicResource.cs @@ -91,7 +91,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 +109,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 +132,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/PartnerNamespaceResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceResource.cs index eca2ad2a02e8..b9ad0eb49874 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerNamespaceResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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/PartnerTopicResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicResource.cs index f3661bd96e89..4ab959d92846 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/PartnerTopicResource.cs @@ -93,7 +93,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 +111,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 +134,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/SystemTopicResource.cs b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicResource.cs index ec0771afe07b..876abac913a0 100644 --- a/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicResource.cs +++ b/sdk/eventgrid/Azure.ResourceManager.EventGrid/src/Generated/SystemTopicResource.cs @@ -93,7 +93,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 +111,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 +134,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/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubResource.cs index 752dc6729858..1d165db13c7a 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubResource.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubResource.cs @@ -90,7 +90,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 +108,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 +131,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 +143,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 +161,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 +184,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/EventHubsDisasterRecoveryResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryResource.cs index 30b6f491b0d5..3323fbf9d8ce 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryResource.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsDisasterRecoveryResource.cs @@ -90,7 +90,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 +108,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 +131,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/EventHubsNamespaceResource.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceResource.cs index 6aa8088fb181..309b04efd434 100644 --- a/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceResource.cs +++ b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/EventHubsNamespaceResource.cs @@ -117,7 +117,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 +135,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 +158,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 +170,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 +188,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 +211,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 +223,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 +241,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 +264,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 +294,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 +317,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 +329,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 +346,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 +368,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 +380,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 +398,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 +421,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/Extensions/EventHubsExtensions.cs b/sdk/eventhub/Azure.ResourceManager.EventHubs/src/Generated/Extensions/EventHubsExtensions.cs index 66b92243844b..31292edb00c5 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 000000000000..6262b818c22b --- /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 000000000000..d597a6d5792c --- /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 000000000000..3f91b7967cb4 --- /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 ca3dbc786f76..000000000000 --- 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 0ba36a4962e6..000000000000 --- 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/src/Generated/Extensions/ExtendedLocationsExtensions.cs b/sdk/extendedlocation/Azure.ResourceManager.ExtendedLocations/src/Generated/Extensions/ExtendedLocationsExtensions.cs index f0c7bb85ca4e..1a1f38d5b44c 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 000000000000..5421162e19d5 --- /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 000000000000..d27c87c39fc3 --- /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 000000000000..614de920974a --- /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 1dbf526f1307..000000000000 --- 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 027f90c17868..000000000000 --- 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/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetResource.cs b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetResource.cs index ceb62d0e77e1..8384ceb12efb 100644 --- a/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetResource.cs +++ b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/ContainerServiceFleetResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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/Extensions/ContainerServiceFleetExtensions.cs b/sdk/fleet/Azure.ResourceManager.ContainerServiceFleet/src/Generated/Extensions/ContainerServiceFleetExtensions.cs index 8646973c2d1d..0d74b28ee8ae 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 000000000000..47239dd45681 --- /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 000000000000..82cf0a389bbb --- /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 000000000000..aa5e3047bc1c --- /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 69e7e4226b64..000000000000 --- 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 895769b4d08d..000000000000 --- 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/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/FluidRelayExtensions.cs b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/Extensions/FluidRelayExtensions.cs index 343eff2ad9c3..18c67673581c 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 000000000000..e7b2c2cef1a3 --- /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 000000000000..57190a55b03c --- /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 000000000000..c8ffb53c9bd1 --- /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 20bea3de437b..000000000000 --- 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 815c8c1ec332..000000000000 --- 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/FluidRelayServerResource.cs b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayServerResource.cs index 388c6d3408e2..74842746216a 100644 --- a/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayServerResource.cs +++ b/sdk/fluidrelay/Azure.ResourceManager.FluidRelay/src/Generated/FluidRelayServerResource.cs @@ -93,7 +93,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 +111,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 +134,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/src/Generated/Extensions/FrontDoorExtensions.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/Extensions/FrontDoorExtensions.cs index 55a339a698f2..eb13b3a0aa7f 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 000000000000..e58971d4ed75 --- /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 000000000000..7da432f4f46a --- /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 000000000000..02c8a89d95a4 --- /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 000000000000..5838d6fd45ac --- /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 85164d777de2..000000000000 --- 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 c23042d4004d..000000000000 --- 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 4d394d283000..000000000000 --- 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/FrontDoorNetworkExperimentProfileResource.cs b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorNetworkExperimentProfileResource.cs index 533de717be63..236ef20e156b 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorNetworkExperimentProfileResource.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorNetworkExperimentProfileResource.cs @@ -98,7 +98,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 +116,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 +139,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 f7a96247f987..a5aac7f8e68a 100644 --- a/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorResource.cs +++ b/sdk/frontdoor/Azure.ResourceManager.FrontDoor/src/Generated/FrontDoorResource.cs @@ -97,7 +97,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 +115,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 +138,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 +150,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 +168,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 +191,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/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/GrafanaExtensions.cs b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/Extensions/GrafanaExtensions.cs index 31bbc71412cf..08886ca0886d 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 000000000000..0be27c34b243 --- /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 000000000000..3d3181db3b48 --- /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 000000000000..dbc37d23f888 --- /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 d0e52b5e481a..000000000000 --- 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 ae9f0d11d0fd..000000000000 --- 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/ManagedGrafanaResource.cs b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/ManagedGrafanaResource.cs index 831be61daa7f..7b0c5875b2bd 100644 --- a/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/ManagedGrafanaResource.cs +++ b/sdk/grafana/Azure.ResourceManager.Grafana/src/Generated/ManagedGrafanaResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/src/Generated/Extensions/GraphServicesExtensions.cs b/sdk/graphservices/Azure.ResourceManager.GraphServices/src/Generated/Extensions/GraphServicesExtensions.cs index 818cbb6b532f..725ffe57e5dc 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 000000000000..1f5635cb15cf --- /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 000000000000..5f98e3366e8b --- /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 000000000000..2ef99eb340e3 --- /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 617b85b306ff..000000000000 --- 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 a7de91f50a1b..000000000000 --- 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/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 4a1aacb3b9bc..000000000000 --- 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 d0b3856bb4c2..fe1fc37394af 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 000000000000..1908321666f4 --- /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 000000000000..ccc18b05c2a9 --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/MockableGuestConfigurationResourceGroupResource.cs @@ -0,0 +1,87 @@ +// 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; + } + + /// + /// 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 GetGuestConfigurationAssignmentsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient.CreateRGListRequest(Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new GuestConfigurationVmAssignmentResource(Client, GuestConfigurationAssignmentData.DeserializeGuestConfigurationAssignmentData(e)), GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics, Pipeline, "MockableGuestConfigurationResourceGroupResource.GetGuestConfigurationAssignments", "value", null, cancellationToken); + } + + /// + /// 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 GetGuestConfigurationAssignments(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient.CreateRGListRequest(Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new GuestConfigurationVmAssignmentResource(Client, GuestConfigurationAssignmentData.DeserializeGuestConfigurationAssignmentData(e)), GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics, Pipeline, "MockableGuestConfigurationResourceGroupResource.GetGuestConfigurationAssignments", "value", null, cancellationToken); + } + } +} 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 000000000000..fb2162b7b8a9 --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/MockableGuestConfigurationSubscriptionResource.cs @@ -0,0 +1,87 @@ +// 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; + } + + /// + /// 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 GetGuestConfigurationAssignmentsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient.CreateSubscriptionListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new GuestConfigurationVmAssignmentResource(Client, GuestConfigurationAssignmentData.DeserializeGuestConfigurationAssignmentData(e)), GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics, Pipeline, "MockableGuestConfigurationSubscriptionResource.GetGuestConfigurationAssignments", "value", null, cancellationToken); + } + + /// + /// 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 GetGuestConfigurationAssignments(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => GuestConfigurationVmAssignmentGuestConfigurationAssignmentsRestClient.CreateSubscriptionListRequest(Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new GuestConfigurationVmAssignmentResource(Client, GuestConfigurationAssignmentData.DeserializeGuestConfigurationAssignmentData(e)), GuestConfigurationVmAssignmentGuestConfigurationAssignmentsClientDiagnostics, Pipeline, "MockableGuestConfigurationSubscriptionResource.GetGuestConfigurationAssignments", "value", null, cancellationToken); + } + } +} 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 9a7afd053dc7..000000000000 --- 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 00789dcd9057..000000000000 --- 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/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/CloudHsmClusterResource.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/CloudHsmClusterResource.cs index d6f900d7e4b6..a8d235a32ceb 100644 --- a/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/CloudHsmClusterResource.cs +++ b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/CloudHsmClusterResource.cs @@ -98,7 +98,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 +116,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 +139,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/Extensions/HardwareSecurityModulesExtensions.cs b/sdk/hardwaresecuritymodules/Azure.ResourceManager.HardwareSecurityModules/src/Generated/Extensions/HardwareSecurityModulesExtensions.cs index 83f70412d38d..d6a07cb97739 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 000000000000..75660e4656ec --- /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 000000000000..a84162af9b29 --- /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 000000000000..2db598d7619d --- /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 d0c2f2a63ad1..000000000000 --- 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 616ea4d5fbc2..000000000000 --- 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/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/HDInsightContainersExtensions.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/Extensions/HDInsightContainersExtensions.cs index c4b7b4dcb717..ae8f9e12094c 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 000000000000..8997785da8d6 --- /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 000000000000..4b301bbcd2c6 --- /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 000000000000..5337cdc448c3 --- /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 3eeaf0da54ea..000000000000 --- 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 2ad106dbe68d..000000000000 --- 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 fd1a76556a8e..12ef8c378540 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterPoolResource.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight.Containers/src/Generated/HDInsightClusterPoolResource.cs @@ -93,7 +93,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 +111,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 +134,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/src/Generated/Extensions/HDInsightExtensions.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/Extensions/HDInsightExtensions.cs index cd9ce4463aac..fddd85aae961 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 000000000000..32ab2daa2de8 --- /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 000000000000..0619240ef32f --- /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 000000000000..565f6533b99d --- /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 1155b189ff6c..000000000000 --- 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 a9fdaa7cfaa7..000000000000 --- 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/HDInsightClusterResource.cs b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightClusterResource.cs index bcfffb23d678..6c665ad24cdd 100644 --- a/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightClusterResource.cs +++ b/sdk/hdinsight/Azure.ResourceManager.HDInsight/src/Generated/HDInsightClusterResource.cs @@ -114,7 +114,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 +132,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 +155,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 +167,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 +185,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 +208,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 +220,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 +238,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 +261,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/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/HealthBotExtensions.cs b/sdk/healthbot/Azure.ResourceManager.HealthBot/src/Generated/Extensions/HealthBotExtensions.cs index e73640138de7..62552b09be8f 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 000000000000..6f284483509d --- /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 000000000000..25e9421a5ebc --- /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 000000000000..0c9b2518bdaa --- /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 ac0fcbbffa60..000000000000 --- 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 08f6dc02f77f..000000000000 --- 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/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/HealthcareApisExtensions.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/Extensions/HealthcareApisExtensions.cs index 00bcadee78fb..b8234d1acc5a 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 000000000000..0483c02efb9c --- /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 000000000000..59807742af57 --- /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 000000000000..aae30a00520c --- /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 1316bd6469aa..000000000000 --- 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 4231692aa0ce..000000000000 --- 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/HealthcareApisIotConnectorResource.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotConnectorResource.cs index 196ae7c0ed84..e782be90cfc6 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotConnectorResource.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisIotConnectorResource.cs @@ -92,7 +92,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 +110,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 +133,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/HealthcareApisServiceResource.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServiceResource.cs index 2b222327a46d..c2bc4b7bb865 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServiceResource.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisServiceResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/HealthcareApisWorkspaceResource.cs b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspaceResource.cs index f50b3032369b..b9cf3cf75780 100644 --- a/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspaceResource.cs +++ b/sdk/healthcareapis/Azure.ResourceManager.HealthcareApis/src/Generated/HealthcareApisWorkspaceResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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 +305,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 +323,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 +346,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/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index f2e3c0b130ca..000000000000 --- 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 08aa47136184..2a76eb4ee406 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 000000000000..0b0472ac46cf --- /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 000000000000..50565e96394b --- /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 000000000000..15daf15b027f --- /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 d1bde90daf96..000000000000 --- 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 bfb4d12886ab..000000000000 --- 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/ProvisionedClusterResource.cs b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/ProvisionedClusterResource.cs index db1d0f2034d4..06b1544d926f 100644 --- a/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/ProvisionedClusterResource.cs +++ b/sdk/hybridaks/Azure.ResourceManager.HybridContainerService/src/Generated/ProvisionedClusterResource.cs @@ -100,7 +100,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 +118,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 +141,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 +153,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 +171,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 +194,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/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/HybridComputeExtensions.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/Extensions/HybridComputeExtensions.cs index 005ca6aae8cc..c4a0d50023c5 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 000000000000..3e13341cc661 --- /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 000000000000..ac8ada4cde3c --- /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 000000000000..253027056a80 --- /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 a4d98b11b08b..000000000000 --- 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 12001559f25b..000000000000 --- 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/HybridComputeMachineResource.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineResource.cs index 3c929770b020..5b11fbd78b5f 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineResource.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputeMachineResource.cs @@ -106,7 +106,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 +124,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 +147,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/HybridComputePrivateLinkScopeResource.cs b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkScopeResource.cs index d3d6494c98f7..51d0030f7b7b 100644 --- a/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkScopeResource.cs +++ b/sdk/hybridcompute/Azure.ResourceManager.HybridCompute/src/Generated/HybridComputePrivateLinkScopeResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index ef9c5efe1023..000000000000 --- 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 130dd6baa23e..847857bca9e7 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 000000000000..cbf322c07d48 --- /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/src/Generated/Extensions/KubernetesExtensions.cs b/sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes/src/Generated/Extensions/KubernetesExtensions.cs index 619b29908f2b..801803c2402d 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 000000000000..1a4d62764ded --- /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 000000000000..bf8cff661578 --- /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 000000000000..a370bec76edd --- /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 40b7f3983e15..000000000000 --- 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 0924967d823a..000000000000 --- 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/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/IotFirmwareDefenseExtensions.cs b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/Extensions/IotFirmwareDefenseExtensions.cs index cda528d5d45d..d02443c9ed1b 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 000000000000..53c5f90ee7c1 --- /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 000000000000..7512c7342481 --- /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 000000000000..af02a39eee7a --- /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 cde6733cec16..000000000000 --- 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 150b933658c3..000000000000 --- 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/FirmwareWorkspaceResource.cs b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareWorkspaceResource.cs index b705a2b38d48..7a9b199bb98f 100644 --- a/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareWorkspaceResource.cs +++ b/sdk/iot/Azure.ResourceManager.IotFirmwareDefense/src/Generated/FirmwareWorkspaceResource.cs @@ -92,7 +92,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 +110,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 +133,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/src/Generated/Extensions/IotCentralExtensions.cs b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/Extensions/IotCentralExtensions.cs index d6b9f0d66b86..0e2a58539ed2 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 000000000000..4ddc3d4d3e21 --- /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 000000000000..1a9367978deb --- /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 000000000000..38b9590ac18a --- /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 645774d459bc..000000000000 --- 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 b70af80d9fcc..000000000000 --- 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 9270510f06ac..1e0ae84d0475 100644 --- a/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralAppResource.cs +++ b/sdk/iotcentral/Azure.ResourceManager.IotCentral/src/Generated/IotCentralAppResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/IotHubExtensions.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/Extensions/IotHubExtensions.cs index 9b461d1752e8..5e236b7d5045 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 000000000000..571cc7ba5352 --- /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 000000000000..943d95557795 --- /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 000000000000..396d7f8d8b67 --- /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 8b1914375b6d..000000000000 --- 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 5f556690caab..000000000000 --- 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/IotHubDescriptionResource.cs b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubDescriptionResource.cs index 68056aaafc29..d88df290795b 100644 --- a/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubDescriptionResource.cs +++ b/sdk/iothub/Azure.ResourceManager.IotHub/src/Generated/IotHubDescriptionResource.cs @@ -96,13 +96,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 +120,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 +144,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 +156,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 +174,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 +197,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 +209,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 +227,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 +250,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 +262,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 +280,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 +303,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/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Extensions/KeyVaultExtensions.cs index 0fb461164070..4297940d6d0b 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 000000000000..ce2710776670 --- /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 000000000000..219b960d37ec --- /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 000000000000..423e180b2085 --- /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 bd48bddaf800..000000000000 --- 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 d95aa8c4e3a4..000000000000 --- 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/KeyVaultResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs index 749b60a96b74..74b0625d416d 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/KeyVaultResource.cs @@ -98,7 +98,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 +116,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 +139,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 +151,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 +169,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 +192,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/ManagedHsmResource.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.cs index 2b6c39485b51..1bbfaab28529 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/ManagedHsmResource.cs @@ -102,7 +102,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 +120,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 +143,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/src/Generated/Extensions/KubernetesConfigurationExtensions.cs b/sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration/src/Generated/Extensions/KubernetesConfigurationExtensions.cs index 2cc80c601a89..a55ef6fe6d19 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 000000000000..f5c1b9ac4ca2 --- /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 000000000000..8e738f434c49 --- /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 ec62f4eb6b57..000000000000 --- 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/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/KustoExtensions.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/Extensions/KustoExtensions.cs index 1908fe1a881f..3f312c2e97eb 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 000000000000..e4deeb44563f --- /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 000000000000..cf08b8e70bf2 --- /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 000000000000..27c78f6e2c48 --- /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 f49013758ecb..000000000000 --- 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 5fd6452371b1..000000000000 --- 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/KustoClusterResource.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterResource.cs index dfa9f4ed5fac..e36d2367deaa 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterResource.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoClusterResource.cs @@ -119,7 +119,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 +137,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 +160,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 +172,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 +190,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 +213,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 +225,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 +243,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 +266,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 +278,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 +296,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 +319,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 +331,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 +349,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 +372,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 +384,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 +402,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 +425,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 +437,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 +455,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 +478,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/KustoDatabaseResource.cs b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabaseResource.cs index fd7e64f20f49..ac5c28d0df12 100644 --- a/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabaseResource.cs +++ b/sdk/kusto/Azure.ResourceManager.Kusto/src/Generated/KustoDatabaseResource.cs @@ -111,7 +111,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 +129,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 +152,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 +164,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 +182,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 +205,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 +217,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 +235,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 +258,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/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/LabServicesExtensions.cs b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/Extensions/LabServicesExtensions.cs index 1d692e525940..89b385728615 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 000000000000..ab3d020d2c42 --- /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 000000000000..394f021505b5 --- /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 000000000000..8a223a7d7014 --- /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 647728d9c8f8..000000000000 --- 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 f1425715fe14..000000000000 --- 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 f2faa0f4718e..41120954e24f 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabPlanResource.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabPlanResource.cs @@ -92,7 +92,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 +110,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 +133,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 01a3e07ba083..45c722e4cb4f 100644 --- a/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabResource.cs +++ b/sdk/labservices/Azure.ResourceManager.LabServices/src/Generated/LabResource.cs @@ -92,7 +92,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 +110,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 +133,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 +145,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 +163,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 +186,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 +198,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 +216,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 +239,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/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/LoadTestingExtensions.cs b/sdk/loadtestservice/Azure.ResourceManager.LoadTesting/src/Generated/Extensions/LoadTestingExtensions.cs index d12ca546e780..d26d7675ef64 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 000000000000..72f9562fe5d7 --- /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 000000000000..c260b8c2cc60 --- /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 000000000000..2908c6f74f32 --- /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 3b6684064c29..000000000000 --- 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 dafdba0f7c1b..000000000000 --- 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/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/LogicExtensions.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/Extensions/LogicExtensions.cs index 0cba29b50914..af5d1c27c10b 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 000000000000..57a02ad134c5 --- /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 000000000000..b30fb7931e72 --- /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 000000000000..345c63085497 --- /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 fb807d1271c5..000000000000 --- 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 3ede1c07a0e3..000000000000 --- 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/IntegrationAccountResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountResource.cs index b0caf6fb20b9..e74b9c5c53ef 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationAccountResource.cs @@ -94,7 +94,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 +112,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 +135,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 +147,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 +165,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 +188,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 +200,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 +218,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 +241,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 +253,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 +271,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 +294,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 +306,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 +324,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 +347,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 +359,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 +377,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 +400,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 +412,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 +430,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 +453,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 +465,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 +483,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 +506,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/IntegrationServiceEnvironmentResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentResource.cs index 6fe72b8faab5..75dc650d5504 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/IntegrationServiceEnvironmentResource.cs @@ -102,7 +102,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 +120,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 +143,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 41171e189ddd..4c73ca634ddd 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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/LogicWorkflowRunActionRepetitionResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionResource.cs index b7426a5a5e7f..606f49fe9bfb 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionRepetitionResource.cs @@ -92,7 +92,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 +110,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 +133,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/LogicWorkflowRunActionResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionResource.cs index 936858a192c9..130833952e70 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunActionResource.cs @@ -92,7 +92,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 +110,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 +133,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 +145,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 +163,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 +186,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 +198,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 +216,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 +239,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/LogicWorkflowRunResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunResource.cs index d23ea5681b49..cd442ec46f07 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowRunResource.cs @@ -90,7 +90,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 +108,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 +131,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 +143,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 +161,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 +184,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/LogicWorkflowTriggerResource.cs b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerResource.cs index 60c4cb384743..fc7095a3a46e 100644 --- a/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerResource.cs +++ b/sdk/logic/Azure.ResourceManager.Logic/src/Generated/LogicWorkflowTriggerResource.cs @@ -91,7 +91,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 +109,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 +132,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/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MachineLearningComputeExtensions.cs b/sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute/src/Generated/Extensions/MachineLearningComputeExtensions.cs index ed8e98da8a4c..9511abe8a18a 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 000000000000..a3b4aaac1316 --- /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 000000000000..cd205d0e99fd --- /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 000000000000..619b53456cd9 --- /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 000000000000..efbd2b59abb0 --- /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 6682e7421c8c..000000000000 --- 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 614fb6155eb2..000000000000 --- 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 922eb80cace3..000000000000 --- 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/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/MachineLearningExtensions.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/Extensions/MachineLearningExtensions.cs index 2f27418ea6ce..2bd8c180acae 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 000000000000..57b528b5ceb5 --- /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 000000000000..69e022a5bb75 --- /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 000000000000..4432d004b508 --- /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 ecfc3a6b3627..000000000000 --- 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 e01328541757..000000000000 --- 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 02bdeb110e1a..0e8b680f5de3 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearninRegistryComponentContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearninRegistryComponentContainerResource.cs @@ -90,7 +90,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 +108,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 +131,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/MachineLearningBatchEndpointResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchEndpointResource.cs index 8f172f63be13..2df6258c128d 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchEndpointResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningBatchEndpointResource.cs @@ -92,7 +92,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 +110,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 +133,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 e6bb135fbd4a..d64bf584df03 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningCodeContainerResource.cs @@ -90,7 +90,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 +108,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 +131,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/MachineLearningComponentContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentContainerResource.cs index bc4a355d9221..b3c59b976959 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningComponentContainerResource.cs @@ -90,7 +90,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 +108,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 +131,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/MachineLearningDataContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataContainerResource.cs index ad3cbeb4ead5..2ae640154f7e 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningDataContainerResource.cs @@ -90,7 +90,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 +108,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 +131,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/MachineLearningEnvironmentContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentContainerResource.cs index 21abbbb167a2..aec6b03eaf73 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningEnvironmentContainerResource.cs @@ -90,7 +90,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 +108,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 +131,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/MachineLearningFeatureSetContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureSetContainerResource.cs index 9139d5d81af2..2327120364e5 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureSetContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureSetContainerResource.cs @@ -90,7 +90,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 +108,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 +131,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 cb1865ffa9e0..d90dc2850020 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureSetVersionResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureSetVersionResource.cs @@ -92,7 +92,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 +110,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 +133,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 2154c19f6b43..54496cd9e6d7 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureStoreEntityContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningFeatureStoreEntityContainerResource.cs @@ -90,7 +90,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 +108,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 +131,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/MachineLearningModelContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelContainerResource.cs index a9a9c60468bf..5712864e706c 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningModelContainerResource.cs @@ -90,7 +90,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 +108,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 +131,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/MachineLearningOnlineEndpointResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineEndpointResource.cs index 175fc1d9e835..23b29a12d310 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineEndpointResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningOnlineEndpointResource.cs @@ -92,7 +92,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 +110,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 +133,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/MachineLearningRegistryCodeContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryCodeContainerResource.cs index df389f08a833..8c259f4ca012 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryCodeContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryCodeContainerResource.cs @@ -90,7 +90,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 +108,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 +131,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/MachineLearningRegistryDataContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryDataContainerResource.cs index 1c0de50b118e..3fd1dc4d1e1e 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryDataContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryDataContainerResource.cs @@ -90,7 +90,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 +108,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 +131,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/MachineLearningRegistryEnvironmentContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryEnvironmentContainerResource.cs index d8d26cf9f491..14314e06f21e 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryEnvironmentContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryEnvironmentContainerResource.cs @@ -90,7 +90,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 +108,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 +131,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/MachineLearningRegistryModelContainerResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryModelContainerResource.cs index abf169fd56a6..6d203a9bee62 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryModelContainerResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryModelContainerResource.cs @@ -90,7 +90,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 +108,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 +131,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/MachineLearningRegistryResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryResource.cs index be4f72d7662e..787114ff6397 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningRegistryResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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 +305,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 +323,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 +346,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/MachineLearningWorkspaceResource.cs b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceResource.cs index e67a157de249..aa5785872f12 100644 --- a/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceResource.cs +++ b/sdk/machinelearningservices/Azure.ResourceManager.MachineLearning/src/Generated/MachineLearningWorkspaceResource.cs @@ -106,7 +106,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 +124,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 +147,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 +159,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 +177,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 +200,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 +212,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 +230,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 +253,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 +265,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 +283,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 +306,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 +318,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 +336,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 +359,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 +371,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 +389,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 +412,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 +424,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 +442,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 +465,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 +477,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 +495,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 +518,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 +530,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 +548,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 +571,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 +583,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 +601,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 +624,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 +636,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 +654,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 +677,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 +689,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 +709,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 +734,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 +746,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 +764,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 +787,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 +799,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 +817,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 +840,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 +852,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 +870,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 +893,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 +905,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 +923,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 +946,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 +958,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 +976,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 +999,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/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MaintenanceExtensions.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MaintenanceExtensions.cs index 12644938a10a..dc1e61b50199 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 000000000000..2a709d82244a --- /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 000000000000..661955368e6e --- /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 000000000000..cb29558ed9fe --- /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 154a784272ec..000000000000 --- 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 b921547d35e3..000000000000 --- 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/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 b4748f270095..000000000000 --- 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 e9a9c1f7afdb..6627548a91fb 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 000000000000..99d315433c73 --- /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 000000000000..ccf32b59092e --- /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 000000000000..f553c6b13317 --- /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 fe9b5263ac21..000000000000 --- 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 72855a96bf58..000000000000 --- 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/ManagedNetworkResource.cs b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkResource.cs index 684dab362b6c..4e3edcd9ae16 100644 --- a/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkResource.cs +++ b/sdk/managednetwork/Azure.ResourceManager.ManagedNetwork/src/Generated/ManagedNetworkResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/ManagedNetworkFabricExtensions.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/Extensions/ManagedNetworkFabricExtensions.cs index 6cab632a853a..65065db33f70 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 000000000000..df851d7699d8 --- /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 000000000000..55fd8d672fc6 --- /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 000000000000..9bd1cee65216 --- /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 30435260e317..000000000000 --- 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 32775a8812e8..000000000000 --- 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/NetworkDeviceResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceResource.cs index 8a8317071473..392430886ddd 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkDeviceResource.cs @@ -93,7 +93,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 +111,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 +134,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/NetworkFabricL3IsolationDomainResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL3IsolationDomainResource.cs index 9cd47592c951..5c26e190e413 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL3IsolationDomainResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricL3IsolationDomainResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/NetworkFabricResource.cs b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricResource.cs index 032b8574ed3a..0f03558e3bfb 100644 --- a/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricResource.cs +++ b/sdk/managednetworkfabric/Azure.ResourceManager.ManagedNetworkFabric/src/Generated/NetworkFabricResource.cs @@ -93,7 +93,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 +111,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 +134,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/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 9ba7f0fbb094..000000000000 --- 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 9495b5e68ddb..271abbcd2b05 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 000000000000..cd80b0878b83 --- /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 000000000000..87f774be5298 --- /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 000000000000..c46d196baf51 --- /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 000000000000..0f657ae1c970 --- /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 76c9977e20fa..000000000000 --- 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 b42f49247034..000000000000 --- 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/UserAssignedIdentityResource.cs b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/UserAssignedIdentityResource.cs index f155d5e64861..198ea6ee2d98 100644 --- a/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/UserAssignedIdentityResource.cs +++ b/sdk/managedserviceidentity/Azure.ResourceManager.ManagedServiceIdentities/src/Generated/UserAssignedIdentityResource.cs @@ -93,7 +93,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 +111,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 +134,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/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/managedservices/Azure.ResourceManager.ManagedServices/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index c908067ab823..000000000000 --- 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 fdfce2421449..74a5e6bc36c4 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 000000000000..16236b2995f9 --- /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/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/Extensions/ManagementPartnerExtensions.cs b/sdk/managementpartner/Azure.ResourceManager.ManagementPartner/src/Generated/Extensions/ManagementPartnerExtensions.cs index 285122844e26..375aa8f62d3c 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 000000000000..bdfbb25cb44e --- /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 000000000000..2c4540cdd12e --- /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 e9325d7068d6..000000000000 --- 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/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/MapsExtensions.cs b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/Extensions/MapsExtensions.cs index 4a488bdbecb2..2fa65174e39c 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 000000000000..ce7a7f85daa2 --- /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 000000000000..41183b574456 --- /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 000000000000..6bcd558c69a8 --- /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 5349ad48c415..000000000000 --- 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 df78aca24d49..000000000000 --- 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 bf73dbdf4791..d1b44251ee99 100644 --- a/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsAccountResource.cs +++ b/sdk/maps/Azure.ResourceManager.Maps/src/Generated/MapsAccountResource.cs @@ -93,7 +93,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 +111,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 +134,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/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Extensions/MarketplaceExtensions.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Extensions/MarketplaceExtensions.cs index 98f3d4541655..4f445c2e763a 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 000000000000..85b86defe22e --- /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 000000000000..185fc2b2d409 --- /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 731bbb4feb2e..000000000000 --- 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/PrivateStoreCollectionInfoResource.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoResource.cs index 7670a1e53d18..053b36245966 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoResource.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoResource.cs @@ -101,7 +101,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 +119,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 +142,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/PrivateStoreResource.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreResource.cs index 3a9f725385d6..37c81c281984 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreResource.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreResource.cs @@ -97,7 +97,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 +115,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 +138,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 +150,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 +169,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 +193,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 +205,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/src/Generated/Extensions/MarketplaceOrderingExtensions.cs b/sdk/marketplaceordering/Azure.ResourceManager.MarketplaceOrdering/src/Generated/Extensions/MarketplaceOrderingExtensions.cs index 623eefb2d9b8..813db77d9ea0 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 000000000000..323259bac20a --- /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 000000000000..709ba9741b28 --- /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 7450d69a5cdc..000000000000 --- 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/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/MediaExtensions.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/Extensions/MediaExtensions.cs index 6d2b78914843..f1e21675b71d 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 000000000000..78fa72b8fabf --- /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 000000000000..eeb4aef877ad --- /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 000000000000..0273ae6beede --- /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 3159e44e4066..000000000000 --- 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 1890146ad745..000000000000 --- 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/MediaAssetResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetResource.cs index ef8b10cb6932..9a0a45a60050 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaAssetResource.cs @@ -92,7 +92,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 +110,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 +133,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 +145,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 +163,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 +186,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/MediaLiveEventResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveEventResource.cs index 049f2100db44..3589ee8e0d1d 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveEventResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaLiveEventResource.cs @@ -92,7 +92,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 +110,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 +133,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/MediaServicesAccountResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountResource.cs index a66678adf322..b49fdcf210bf 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaServicesAccountResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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 +305,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 +323,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 +346,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 +358,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 +376,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 +399,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 +411,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 +429,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 +452,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 +464,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 +482,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 +505,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 +517,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 +535,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 +558,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 +570,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 +588,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 +611,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/MediaTransformResource.cs b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaTransformResource.cs index d5fdf5331544..b7f20301fc6c 100644 --- a/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaTransformResource.cs +++ b/sdk/mediaservices/Azure.ResourceManager.Media/src/Generated/MediaTransformResource.cs @@ -90,7 +90,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 +108,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 +131,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/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/MixedRealityExtensions.cs b/sdk/mixedreality/Azure.ResourceManager.MixedReality/src/Generated/Extensions/MixedRealityExtensions.cs index 8a9da3fe5499..caaa5c698c29 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 000000000000..8fde0d40478b --- /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 000000000000..549f79ad2acb --- /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 000000000000..0db11f4d4675 --- /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 19e16f03c073..000000000000 --- 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 bfec960a9a2b..000000000000 --- 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/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MobileNetworkExtensions.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/Extensions/MobileNetworkExtensions.cs index 72039f51f172..343e5fb1d868 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 000000000000..8f71a0f9d9cf --- /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 000000000000..bfb4e7b1d741 --- /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 000000000000..a17337c5b6de --- /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 000000000000..76fc041b8b2d --- /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 ae9df5309c89..000000000000 --- 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 c3888b94fe58..000000000000 --- 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 e614c49faba6..000000000000 --- 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/MobileNetworkResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkResource.cs index 30f83f497361..31b87eaeadba 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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 +305,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 +323,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 +346,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/MobileNetworkSimGroupResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimGroupResource.cs index b9964b32858e..af7dc724a1c0 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimGroupResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/MobileNetworkSimGroupResource.cs @@ -98,7 +98,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 +116,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 +139,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/PacketCoreControlPlaneResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreControlPlaneResource.cs index b46d3497179a..e2dc5939e1de 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreControlPlaneResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreControlPlaneResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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/PacketCoreDataPlaneResource.cs b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreDataPlaneResource.cs index a36a93d37bc2..2e83f74bec9c 100644 --- a/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreDataPlaneResource.cs +++ b/sdk/mobilenetwork/Azure.ResourceManager.MobileNetwork/src/Generated/PacketCoreDataPlaneResource.cs @@ -92,7 +92,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 +110,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 +133,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/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 376d1af6787c..000000000000 --- 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 000000000000..c46964181ecc --- /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 000000000000..704a6a3e95a1 --- /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 000000000000..3e8d2e358412 --- /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 000000000000..e6c4b52a010c --- /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 c8cdea4dd007..97b56c4c5e82 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 3f878efff98f..000000000000 --- 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 bcba8371c2d9..000000000000 --- 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 665aa0e90a91..000000000000 --- 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/MonitorPrivateLinkScopeResource.cs b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopeResource.cs index f845c79fc08b..31f6bf8f80fe 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopeResource.cs +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/Generated/MonitorPrivateLinkScopeResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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/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 000000000000..dbfea3abc5c8 --- /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 000000000000..a17aaf4a1514 --- /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 000000000000..914107d5bf38 --- /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 965ad5854da7..1ce19828fde8 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 9a81738317f0..000000000000 --- 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 60cfe673105a..000000000000 --- 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 baa2ac6fe502..a47bbb69cd7a 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlAdvisorResource.cs @@ -94,7 +94,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 +112,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 +135,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/MySqlServerResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerResource.cs index 1797d88ba720..c4d33ba76ad3 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySql/Generated/MySqlServerResource.cs @@ -118,7 +118,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 +136,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 +159,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 +171,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 +189,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 +212,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 +224,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 +242,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 +265,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 +277,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 +295,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 +318,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 +337,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 +386,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 +404,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 +427,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 +439,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 +457,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 +480,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 +492,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 +510,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 +533,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 +545,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 +563,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 +586,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 +598,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 +616,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 +639,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 +651,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 +669,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 +692,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 +704,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 +722,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 +745,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/MySqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs index 5871205b74d4..7b83e852d7df 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,134 @@ 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); } - #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 +162,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 +190,20 @@ 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); } /// @@ -248,13 +218,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 +243,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 +268,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 +279,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 +294,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 +305,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 +320,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 +332,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 +347,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 +359,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 +374,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 +386,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 +401,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 +413,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 +428,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 +439,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 +454,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 +465,7 @@ 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 GetSubscriptionResourceExtensionClient(subscriptionResource).CheckMySqlFlexibleServerNameAvailabilityWithoutLocation(content, cancellationToken); + return GetMockableMySqlFlexibleServersSubscriptionResource(subscriptionResource).CheckMySqlFlexibleServerNameAvailabilityWithoutLocation(content, cancellationToken); } /// @@ -482,12 +480,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 +504,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 000000000000..0224a5ae8433 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/MockableMySqlFlexibleServersArmClient.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.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); + } + } +} 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 000000000000..75dd12be9929 --- /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 000000000000..486ec2d81b69 --- /dev/null +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/Extensions/MockableMySqlFlexibleServersSubscriptionResource.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.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; + + /// 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 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, "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; + } + } + } +} 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 000000000000..9caf7028f97c --- /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 f6b92bac38da..000000000000 --- 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 abf6b109ea72..000000000000 --- 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 bf0b0866fe16..000000000000 --- 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/MySqlFlexibleServerResource.cs b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerResource.cs index 6519b6ad1ebc..0e46365cbb2a 100644 --- a/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerResource.cs +++ b/sdk/mysql/Azure.ResourceManager.MySql/src/MySqlFlexibleServers/Generated/MySqlFlexibleServerResource.cs @@ -107,7 +107,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 +156,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 +174,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 +197,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 +209,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 +227,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 +250,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 +262,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 +280,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 +303,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 +315,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 +333,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 +356,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) { diff --git a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.cs index 5c6a752575fc..cad02cb59396 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/CapacityPoolResource.cs @@ -92,7 +92,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 +110,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 +133,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 000000000000..c94688ba7f0f --- /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 000000000000..429472c50932 --- /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 000000000000..83feb7a5622a --- /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 9d8a9f124808..cf9a93fc1e4e 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 51609d609e1f..000000000000 --- 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 dedbaa98ecac..000000000000 --- 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/NetAppAccountResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountResource.cs index 220b79542c63..7e3839356157 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppAccountResource.cs @@ -99,7 +99,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 +117,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 +140,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 +152,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 +170,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 +193,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 +205,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 +223,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 +246,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 +258,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 +276,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 +299,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/NetAppVolumeResource.cs b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeResource.cs index c552ca0e9312..c1a4cf59431d 100644 --- a/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeResource.cs +++ b/sdk/netapp/Azure.ResourceManager.NetApp/src/Generated/NetAppVolumeResource.cs @@ -97,7 +97,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 +115,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 +138,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 +150,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 +168,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 +191,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 +203,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 +221,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 +244,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/network/Azure.ResourceManager.Network/src/Generated/AdminRuleGroupResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/AdminRuleGroupResource.cs index c79b3efe5803..332de50e10e2 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/AdminRuleGroupResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/AdminRuleGroupResource.cs @@ -90,7 +90,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 +108,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 +131,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/ApplicationGatewayResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayResource.cs index 78051b280d1d..07bd8a681c9e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayResource.cs @@ -98,7 +98,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 +116,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 +139,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/ExpressRouteCircuitPeeringResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitPeeringResource.cs index cfe69db0150a..601778b7b1ba 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitPeeringResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitPeeringResource.cs @@ -96,7 +96,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 +114,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 +137,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 +149,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 +167,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 +190,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 3c91b792152a..4ef304bc834f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/ExpressRouteCrossConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionResource.cs index 185a8249408c..515407f58cc5 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionResource.cs @@ -93,7 +93,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 +111,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 +134,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 599c36e3546d..303b2cf8f2a0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteGatewayResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteGatewayResource.cs @@ -93,7 +93,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 +111,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 +134,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/ExpressRoutePortResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortResource.cs index f76df3d25248..ada0f1977e44 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/Extensions/ManagementGroupResourceExtensionClient.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Extensions/ManagementGroupResourceExtensionClient.cs deleted file mode 100644 index d680f58f9dbd..000000000000 --- 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 000000000000..494076fbc6cc --- /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 000000000000..a1fb9869cc52 --- /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 000000000000..025e3aba418f --- /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 000000000000..75f99496dca8 --- /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 4997a4ba859c..dbdd746e6dfe 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 417b8f76d9c9..000000000000 --- 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 89496a249ba3..000000000000 --- 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 d19afa7be5e5..7af535c1d299 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyResource.cs @@ -101,7 +101,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 +119,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 +142,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/LoadBalancerResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancerResource.cs index f81ee70080ef..344c67b632c8 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancerResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancerResource.cs @@ -98,7 +98,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 +116,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 +139,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 +151,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 +169,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 +192,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 +204,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 +223,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 +247,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 +259,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 +277,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 +300,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 +312,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 +330,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 +353,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 +365,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 +383,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 +406,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/NetworkGroupResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupResource.cs index 964daa40daf4..f6d983c8bb0e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkGroupResource.cs @@ -90,7 +90,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 +108,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 +131,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/NetworkInterfaceResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceResource.cs index 448b4ffd5e8d..a9af16675b98 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceResource.cs @@ -98,7 +98,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 +116,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 +139,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 +151,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 +169,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 +192,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/NetworkManagerResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkManagerResource.cs index 647f2f66b585..c0b42c56357e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkManagerResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkManagerResource.cs @@ -107,7 +107,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 +125,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 +148,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 +160,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 +178,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 +201,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 +213,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 +231,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 +254,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 +266,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 +284,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 +307,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/NetworkSecurityGroupResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkSecurityGroupResource.cs index 49489f611c16..8ea893d56f4f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkSecurityGroupResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkSecurityGroupResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/NetworkVirtualApplianceResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceResource.cs index f6535deffd28..b7ee53c7f9a2 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceResource.cs @@ -97,7 +97,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 +115,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 +138,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 +150,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 +168,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 +191,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/NetworkWatcherResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkWatcherResource.cs index f080ad4c3d56..1c5c431878ea 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkWatcherResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkWatcherResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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/PrivateEndpointResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateEndpointResource.cs index c49e2a233828..f7c78296f7cc 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateEndpointResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateEndpointResource.cs @@ -92,7 +92,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 +110,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 +133,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 cb305739b114..d32f5ac4888a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateLinkServiceResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateLinkServiceResource.cs @@ -92,7 +92,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 +111,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 +135,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/RouteFilterResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterResource.cs index b85932b50990..5ed3beaeaba5 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterResource.cs @@ -93,7 +93,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 +111,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 +134,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/RouteTableResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteTableResource.cs index 8908ea0b8284..6a5e46f6f9f1 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteTableResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteTableResource.cs @@ -93,7 +93,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 +111,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 +134,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/SecurityAdminConfigurationResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityAdminConfigurationResource.cs index b7b869f6c40a..23320dded85c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityAdminConfigurationResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityAdminConfigurationResource.cs @@ -90,7 +90,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 +108,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 +131,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/ServiceEndpointPolicyResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyResource.cs index ab579cc8e1d9..d1a673e9cbde 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyResource.cs @@ -93,7 +93,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 +111,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 +134,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/VirtualHubResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubResource.cs index 42fa48037156..2a02453329d8 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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 +305,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 +323,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 +346,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 +358,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 +376,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 +399,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 +411,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 +429,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 +452,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/VirtualNetworkGatewayResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayResource.cs index 853876592f19..4d09048232df 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayResource.cs @@ -94,7 +94,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 +112,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 +135,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/VirtualNetworkResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkResource.cs index 204fb1267494..828e5a8ec9b6 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkResource.cs @@ -99,7 +99,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 +118,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 +142,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 +154,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 +172,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 +195,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/VirtualRouterResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterResource.cs index 6b044ff765d2..ac422beafaa6 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterResource.cs @@ -92,7 +92,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 +110,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 +133,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/VpnConnectionResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnConnectionResource.cs index 6c2f9ec24030..25aec3af4260 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnConnectionResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnConnectionResource.cs @@ -91,7 +91,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 +109,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 +132,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/VpnGatewayResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayResource.cs index 40c61ca245ef..5868f5987bf6 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/VpnServerConfigurationResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationResource.cs index 5d766ecef5fe..36f12151b31a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationResource.cs @@ -93,7 +93,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 +111,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 +134,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/VpnSiteResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteResource.cs index 15a54f52291e..ff942978bdbe 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteResource.cs @@ -93,7 +93,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 +111,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 +134,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/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 000000000000..d7652172fdae --- /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 000000000000..de559747f006 --- /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 000000000000..b9cd1d17197c --- /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 906ed4ce0f61..429b6aa25454 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 0d7ab7ef8bce..000000000000 --- 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 1a6aeb1dc118..000000000000 --- 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/src/Generated/Extensions/MockableNetworkCloudArmClient.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/Extensions/MockableNetworkCloudArmClient.cs new file mode 100644 index 000000000000..ab5d8551fdb4 --- /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 000000000000..48d7f89b0699 --- /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 000000000000..261644e99413 --- /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 8d626c63a823..b7b61b0e4915 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 99171835b9cb..000000000000 --- 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 b05e250e63aa..000000000000 --- 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/NetworkCloudClusterResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterResource.cs index e1669745e9e5..8c252e370fa3 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudClusterResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 e4e93223528b..796ef8e028bd 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudKubernetesClusterResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudKubernetesClusterResource.cs @@ -93,7 +93,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 +111,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 +134,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/NetworkCloudVirtualMachineResource.cs b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineResource.cs index fee8d99c22c6..cb7e1279b891 100644 --- a/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineResource.cs +++ b/sdk/networkcloud/Azure.ResourceManager.NetworkCloud/src/Generated/NetworkCloudVirtualMachineResource.cs @@ -93,7 +93,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 +111,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 +134,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/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/AzureTrafficCollectorResource.cs b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/AzureTrafficCollectorResource.cs index b981b6e701d8..a51e047e0464 100644 --- a/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/AzureTrafficCollectorResource.cs +++ b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/AzureTrafficCollectorResource.cs @@ -93,7 +93,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 +111,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 +134,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/Extensions/MockableNetworkFunctionArmClient.cs b/sdk/networkfunction/Azure.ResourceManager.NetworkFunction/src/Generated/Extensions/MockableNetworkFunctionArmClient.cs new file mode 100644 index 000000000000..55054fcb744d --- /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 000000000000..37df53b97b5b --- /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 000000000000..066e354e8f5b --- /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 4a1aadd97d96..1bd5e576b12f 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 f6da75c891d9..000000000000 --- 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 1ebf2dc0c8d3..000000000000 --- 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/src/Generated/Extensions/MockableNewRelicObservabilityArmClient.cs b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/Extensions/MockableNewRelicObservabilityArmClient.cs new file mode 100644 index 000000000000..b245146e45a9 --- /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 000000000000..ca74e3b7caad --- /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 000000000000..c1d2e86984ed --- /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 63ed3148b37a..b111f7ee301a 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 f50e139d5122..000000000000 --- 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 8d314857ef89..000000000000 --- 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 fec613a795ab..f0dd8367dba6 100644 --- a/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicMonitorResource.cs +++ b/sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability/src/Generated/NewRelicMonitorResource.cs @@ -94,7 +94,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 +112,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 +135,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/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 000000000000..70a32c10106d --- /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 000000000000..1889c85113ef --- /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 000000000000..aced2a0cbce8 --- /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 0bd9e7839fa4..8850c42e6000 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 3bdaae57228b..000000000000 --- 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 6e2b42c2587a..000000000000 --- 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/NginxDeploymentResource.cs b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxDeploymentResource.cs index 42f4795d0cd5..1110ac7c8e82 100644 --- a/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxDeploymentResource.cs +++ b/sdk/nginx/Azure.ResourceManager.Nginx/src/Generated/NginxDeploymentResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/src/Generated/Extensions/MockableNotificationHubsArmClient.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/Extensions/MockableNotificationHubsArmClient.cs new file mode 100644 index 000000000000..e1c8a0e4aa94 --- /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 000000000000..55940c8117c8 --- /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 000000000000..926111724845 --- /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 abb488051ec2..cfab41ee8ce0 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 6ed679de8b08..000000000000 --- 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 d7306a039ab7..000000000000 --- 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/NotificationHubNamespaceResource.cs b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs index 65dbf24a50c4..d0c38b9a4de5 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubNamespaceResource.cs @@ -97,7 +97,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 +115,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 +138,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 +150,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 +168,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 +191,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 f0b407adc62e..bfc4471d8421 100644 --- a/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs +++ b/sdk/notificationhubs/Azure.ResourceManager.NotificationHubs/src/Generated/NotificationHubResource.cs @@ -92,7 +92,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 +110,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 +133,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/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/EnergyServicesExtensions.cs b/sdk/openenergyplatform/Azure.ResourceManager.EnergyServices/src/Generated/Extensions/EnergyServicesExtensions.cs index 28f24985b0f8..3ee7fcf909c4 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 000000000000..c4e223323642 --- /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 000000000000..2b5e8a3e68ff --- /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 000000000000..eec4ddf2ee3d --- /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 b9f0b6bae032..000000000000 --- 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 f64fa14a9605..000000000000 --- 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/src/Generated/Extensions/MockableOperationalInsightsArmClient.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/Extensions/MockableOperationalInsightsArmClient.cs new file mode 100644 index 000000000000..f887e80a63e4 --- /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 000000000000..73abf6988388 --- /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 000000000000..4edbeb2ee0f1 --- /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 2469b03bd6af..e81ca5d02044 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 8c6af96c7980..000000000000 --- 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 8891deb9d526..000000000000 --- 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 41b88691c0d3..22e61271ed3d 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryPackResource.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/LogAnalyticsQueryPackResource.cs @@ -99,7 +99,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 +117,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 +140,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/OperationalInsightsWorkspaceResource.cs b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsWorkspaceResource.cs index 95ad403fe13e..0a505ed9705f 100644 --- a/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsWorkspaceResource.cs +++ b/sdk/operationalinsights/Azure.ResourceManager.OperationalInsights/src/Generated/OperationalInsightsWorkspaceResource.cs @@ -126,7 +126,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 +144,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 +167,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 +179,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 +197,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 +220,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 +232,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 +250,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 +273,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 +285,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 +334,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 +352,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 +375,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 +387,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 +405,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 +428,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 +440,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 +458,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 +481,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/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 000000000000..638cae0e3e4e --- /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 000000000000..eb22b385732e --- /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 000000000000..cd2d803a7d40 --- /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 c358ea26e85f..81a589df6420 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 e452e4ac0f9a..000000000000 --- 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 68fbde0c3f7a..000000000000 --- 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/OrbitalSpacecraftResource.cs b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalSpacecraftResource.cs index 0d5cc47dcd23..88e5a14a3719 100644 --- a/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalSpacecraftResource.cs +++ b/sdk/orbital/Azure.ResourceManager.Orbital/src/Generated/OrbitalSpacecraftResource.cs @@ -93,7 +93,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 +111,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 +134,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/src/Generated/Extensions/MockablePaloAltoNetworksNgfwArmClient.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/Extensions/MockablePaloAltoNetworksNgfwArmClient.cs new file mode 100644 index 000000000000..7f83bac066d9 --- /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 000000000000..27589ed049e2 --- /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 000000000000..086af55a8724 --- /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 000000000000..c4737aaff565 --- /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 6babf1d380ef..c955b943bf37 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 8115d9e6845a..000000000000 --- 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 ff35ad18c2d0..000000000000 --- 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 d3c08f729398..000000000000 --- 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/GlobalRulestackResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/GlobalRulestackResource.cs index af0fab7f3683..c25b9e6adbba 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 @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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 +305,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 +323,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 +346,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/LocalRulestackResource.cs b/sdk/paloaltonetworks.ngfw/Azure.ResourceManager.PaloAltoNetworks.Ngfw/src/Generated/LocalRulestackResource.cs index 1da0cb91e70f..07f0fdfe41d1 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 @@ -94,7 +94,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 +112,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 +135,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 +147,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 +165,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 +188,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 +200,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 +218,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 +241,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 +253,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 +271,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 +294,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/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 000000000000..1cec286d6cf5 --- /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 000000000000..df745fa93045 --- /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 000000000000..26a7d70b7250 --- /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 a46d8a056cb9..9105e6d492b7 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 7af68a7a83c5..000000000000 --- 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 d7e40bc28fd8..000000000000 --- 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/PeeringResource.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringResource.cs index 127769602746..a66a8ce6a554 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringResource.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringResource.cs @@ -102,7 +102,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 +120,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 +143,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 +155,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 +173,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 +196,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/PeeringServiceResource.cs b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServiceResource.cs index ef48ad4f0e6f..3d54163120a7 100644 --- a/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServiceResource.cs +++ b/sdk/peering/Azure.ResourceManager.Peering/src/Generated/PeeringServiceResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +165,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 +189,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/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/policyinsights/Azure.ResourceManager.PolicyInsights/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index 0d3c9db5117b..000000000000 --- 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 aa11be80a77b..000000000000 --- 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 000000000000..90774928504a --- /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 000000000000..a3108e21f45e --- /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 000000000000..2dd7ae6e283c --- /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 000000000000..07f8d529f0db --- /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 000000000000..f4991df94408 --- /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 6daca714d386..b30f330cd297 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 1fa1255266aa..000000000000 --- 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 0362d28004ea..000000000000 --- 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 adfc9a5d3fd4..000000000000 --- 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/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 000000000000..26bff0517223 --- /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 000000000000..8dac60102bd2 --- /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 000000000000..257944a7f984 --- /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 8a3289f9fa39..c60ccddf1b9d 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 46cd056c429b..000000000000 --- 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 c5f8c73b20ab..000000000000 --- 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/PostgreSqlServerResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerResource.cs index a7efb75139ae..cdd84fddfed1 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/PostgreSqlServerResource.cs @@ -110,7 +110,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 +128,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 +151,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 +163,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 +181,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 +204,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 +216,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 +234,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 +257,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 +269,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 +287,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 +310,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 +329,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 +378,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 +396,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 +419,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 +431,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 +449,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 +472,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 +484,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 +502,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 +525,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/PostgreSqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Extensions/FlexibleServersExtensions.cs index 929c823d9440..1223939d9ef8 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 000000000000..cb1d1fcbcc68 --- /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 000000000000..5561c1711fca --- /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 000000000000..35d8ceafc82b --- /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 000000000000..70c6a0f5a8bd --- /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 143eadb87c54..000000000000 --- 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 3e335cbefe4b..000000000000 --- 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 b7a7c06aa8c3..000000000000 --- 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/PostgreSqlFlexibleServerResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerResource.cs index 60af361759e2..449f719f0707 100644 --- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerResource.cs +++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/PostgreSqlFlexibleServerResource.cs @@ -110,7 +110,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 +128,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 +151,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 +163,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 +181,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 +204,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 +216,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 +234,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 +257,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 +269,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 +287,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 +310,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 +322,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 +340,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 +363,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 +375,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 +393,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 +416,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 +428,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 +446,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 +469,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/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 000000000000..b71d89aa3980 --- /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 000000000000..991777f3cc9c --- /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 000000000000..a3427f41f354 --- /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 70eab902cfdf..a0a18c135654 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 b5a6b737ef05..000000000000 --- 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 43d508f594bc..000000000000 --- 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/src/Generated/Extensions/MockablePrivateDnsArmClient.cs b/sdk/privatedns/Azure.ResourceManager.PrivateDns/src/Generated/Extensions/MockablePrivateDnsArmClient.cs new file mode 100644 index 000000000000..6cf87fa806d3 --- /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 000000000000..f1265cee79e8 --- /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 000000000000..071262b447a5 --- /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 ed7989f2e08d..1e21edfa6802 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 a8e2975e741f..000000000000 --- 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 2f5c45cb0b6b..000000000000 --- 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/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 000000000000..3f0abc3c2387 --- /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 000000000000..2546d5c30f25 --- /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 0b8f18fdb731..00ff3d2b6062 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 8f07a6732b56..000000000000 --- 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/ProviderRegistrationResource.cs b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ProviderRegistrationResource.cs index 4aaef2065396..7a97ee3c48c7 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ProviderRegistrationResource.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ProviderRegistrationResource.cs @@ -96,7 +96,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 +114,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 +137,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 +149,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 +167,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 +190,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 +202,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 +220,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 +243,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 +255,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 +273,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 +296,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 d885048d7945..b0b6c750fd88 100644 --- a/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeRegistrationResource.cs +++ b/sdk/providerhub/Azure.ResourceManager.ProviderHub/src/Generated/ResourceTypeRegistrationResource.cs @@ -90,7 +90,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 +108,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 +131,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 +141,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 +165,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 +189,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 +200,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 +225,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 +250,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 +262,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 +288,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 +314,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/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 000000000000..7426ccc74b18 --- /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 000000000000..5da7eae98eb3 --- /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 000000000000..b2b93b708b39 --- /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 000000000000..aa9fb8a8f21b --- /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 96683532b51b..48a9576b4c32 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 f8d64e6cf13b..000000000000 --- 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 c14a968a7182..000000000000 --- 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 0c05ae6f6ce1..000000000000 --- 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 3f7e9375380c..667aa2bc79d1 100644 --- a/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewAccountResource.cs +++ b/sdk/purview/Azure.ResourceManager.Purview/src/Generated/PurviewAccountResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/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 000000000000..24168dd7403b --- /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 000000000000..40a6cbaa53b1 --- /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 000000000000..ded0e81399dd --- /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 8fd23a8decbe..c9b536b74cac 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 ec146eb5a8c8..000000000000 --- 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 ef6516614d54..000000000000 --- 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/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 000000000000..af4e6cd17fd1 --- /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 000000000000..72ec4bb8d4e9 --- /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 000000000000..551945309566 --- /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 cc098bea72c2..1a5413c8e31b 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 44a3cac71aed..000000000000 --- 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 bcf986604931..000000000000 --- 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/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 acd067670610..000000000000 --- 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 000000000000..c51880bd4e52 --- /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 000000000000..b88404d89f27 --- /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 41dda3945133..a45014ffca94 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 41343bb69708..000000000000 --- 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/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectedItemResource.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectedItemResource.cs index a5a5d0796c4b..fe4aef63f4b4 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectedItemResource.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectedItemResource.cs @@ -101,7 +101,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 +120,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 +144,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 4d66fc870fe1..5fcade954b76 100644 --- a/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionContainerResource.cs +++ b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/BackupProtectionContainerResource.cs @@ -98,7 +98,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 +118,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 +143,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/Extensions/MockableRecoveryServicesBackupArmClient.cs b/sdk/recoveryservices-backup/Azure.ResourceManager.RecoveryServicesBackup/src/Generated/Extensions/MockableRecoveryServicesBackupArmClient.cs new file mode 100644 index 000000000000..fd297641ad66 --- /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 000000000000..36b580cb6812 --- /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 000000000000..07ddb5e2dd26 --- /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 bc20d599d96e..55c5bae02691 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 73b2172c0c0a..000000000000 --- 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 67dcfe9ae991..000000000000 --- 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-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricResource.cs index 0115d392e7d5..cf24cf371138 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricResource.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationFabricResource.cs @@ -93,7 +93,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 +111,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 +134,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/DataReplicationProtectedItemResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemResource.cs index 29efc9f05ed8..48b0f5e0de04 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemResource.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationProtectedItemResource.cs @@ -91,7 +91,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 +109,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 +132,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/DataReplicationVaultResource.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultResource.cs index 2c48bd5d8a6f..0409a79354e1 100644 --- a/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultResource.cs +++ b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/DataReplicationVaultResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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 +305,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 +323,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 +346,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 +358,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 +376,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 +399,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/Extensions/MockableRecoveryServicesDataReplicationArmClient.cs b/sdk/recoveryservices-datareplication/Azure.ResourceManager.RecoveryServicesDataReplication/src/Generated/Extensions/MockableRecoveryServicesDataReplicationArmClient.cs new file mode 100644 index 000000000000..698f777acb02 --- /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 000000000000..8054ee6d909d --- /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 000000000000..fa588cd50ef6 --- /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 a7f4414a17e6..59c73b5d26d7 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 28bf48155fcc..000000000000 --- 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 3ffb3aaf3ae3..000000000000 --- 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/src/Generated/Extensions/MockableRecoveryServicesSiteRecoveryArmClient.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/Extensions/MockableRecoveryServicesSiteRecoveryArmClient.cs new file mode 100644 index 000000000000..c02a181ef004 --- /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 000000000000..fa7abbc4cd02 --- /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 85badd6bf35c..bdcd1f57ba4f 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 5000af15cb07..000000000000 --- 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/ReplicationProtectedItemResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectedItemResource.cs index 47958df07077..bfb9aae177e2 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectedItemResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/ReplicationProtectedItemResource.cs @@ -96,7 +96,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 +114,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 +137,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/SiteRecoveryFabricResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryFabricResource.cs index 62b9d4a09259..588b4ff3a6f3 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryFabricResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryFabricResource.cs @@ -92,7 +92,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 +110,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 +133,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 +145,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 +163,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 +186,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 +198,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 +216,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 +239,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 +251,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 +269,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 +292,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 +304,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 +322,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 +345,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 +357,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 +375,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 +398,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/SiteRecoveryMigrationItemResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryMigrationItemResource.cs index 5f13df3db945..cef32cbea0e0 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryMigrationItemResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryMigrationItemResource.cs @@ -91,7 +91,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 +109,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 +132,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/SiteRecoveryNetworkResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkResource.cs index 2aaa14926e43..ed246fbafcf3 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryNetworkResource.cs @@ -90,7 +90,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 +108,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 +131,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/SiteRecoveryProtectionContainerResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectionContainerResource.cs index e3e85f79ed02..65211336bfb0 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectionContainerResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/SiteRecoveryProtectionContainerResource.cs @@ -91,7 +91,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 +109,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 +132,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 +144,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 +162,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 +185,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 +197,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 +215,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 +238,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 +250,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 +268,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 +291,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/StorageClassificationResource.cs b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationResource.cs index 80d873fb0493..f796f6b3d725 100644 --- a/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationResource.cs +++ b/sdk/recoveryservices-siterecovery/Azure.ResourceManager.RecoveryServicesSiteRecovery/src/Generated/StorageClassificationResource.cs @@ -90,7 +90,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 +108,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 +131,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/src/Generated/Extensions/MockableRecoveryServicesArmClient.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/Extensions/MockableRecoveryServicesArmClient.cs new file mode 100644 index 000000000000..318fc1bac17a --- /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 000000000000..a977bc529e01 --- /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 000000000000..5a78458f4300 --- /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 b3ffcb49e641..09d189e6c5b9 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 7dddcc16c0cb..000000000000 --- 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 372b1e808746..000000000000 --- 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/RecoveryServicesVaultResource.cs b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesVaultResource.cs index 6428d561d3fb..42e9ef470b82 100644 --- a/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesVaultResource.cs +++ b/sdk/recoveryservices/Azure.ResourceManager.RecoveryServices/src/Generated/RecoveryServicesVaultResource.cs @@ -110,7 +110,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 +128,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 +151,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/src/Generated/Extensions/MockableRedisArmClient.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisArmClient.cs new file mode 100644 index 000000000000..31acdfda6d58 --- /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 000000000000..073353359a08 --- /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 000000000000..ba8e37c2de40 --- /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 bb2f25a9ee79..03e77d62af7a 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 3b91688e9110..000000000000 --- 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 dc8fb907c4dc..000000000000 --- 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/RedisResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs index 410a404b6f95..d117d3c3e597 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs @@ -98,7 +98,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 +116,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 +139,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 +151,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 +200,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 +218,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 +241,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 +253,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 +271,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 +294,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/src/Generated/Extensions/MockableRedisEnterpriseArmClient.cs b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/Extensions/MockableRedisEnterpriseArmClient.cs new file mode 100644 index 000000000000..7011973fbe47 --- /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 000000000000..cd4196a46356 --- /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 000000000000..3313e814be6e --- /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 9d821d222bb4..4ca7f2ea2b20 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 643384b3cc58..000000000000 --- 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 03154ad913ef..000000000000 --- 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 a11ebb289fea..6bff9a04a331 100644 --- a/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseClusterResource.cs +++ b/sdk/redisenterprise/Azure.ResourceManager.RedisEnterprise/src/Generated/RedisEnterpriseClusterResource.cs @@ -98,7 +98,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 +116,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 +139,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 +151,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 +169,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 +192,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/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 000000000000..8b63079e79f3 --- /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 000000000000..492d60b3ff47 --- /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 000000000000..81664cdb0833 --- /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 4ce1952a888d..db21112d6835 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 18e6c2bb452d..000000000000 --- 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 597334524cde..000000000000 --- 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/RelayHybridConnectionResource.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionResource.cs index cf76f2701a7d..8c4f64abd0d6 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionResource.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayHybridConnectionResource.cs @@ -90,7 +90,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 +108,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 +131,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/RelayNamespaceResource.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceResource.cs index 5fd5c261f281..8612bda9cbec 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceResource.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/RelayNamespaceResource.cs @@ -93,7 +93,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 +111,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 +134,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 +153,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 +171,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 +194,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 +206,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 +224,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 +247,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 +259,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 +277,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 +300,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 +312,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 +330,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 +353,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/WcfRelayResource.cs b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayResource.cs index b719d9e8d226..e42acd13684a 100644 --- a/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayResource.cs +++ b/sdk/relay/Azure.ResourceManager.Relay/src/Generated/WcfRelayResource.cs @@ -90,7 +90,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 +108,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 +131,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/src/Generated/Extensions/MockableReservationsArmClient.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/Extensions/MockableReservationsArmClient.cs new file mode 100644 index 000000000000..5ede1c3df427 --- /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 000000000000..9fd785aca2d8 --- /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 000000000000..059f06963587 --- /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 ea71a9bc1f51..0bfe32f80145 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 90e9f26c50fa..000000000000 --- 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 eddfe959cf73..000000000000 --- 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/ReservationOrderResource.cs b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationOrderResource.cs index 557bf300e3ee..8367806edaf4 100644 --- a/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationOrderResource.cs +++ b/sdk/reservations/Azure.ResourceManager.Reservations/src/Generated/ReservationOrderResource.cs @@ -106,7 +106,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/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 000000000000..84c00e5e45ce --- /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 000000000000..abf5a3b12e29 --- /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 000000000000..798d21dbc778 --- /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 1f702d8194ff..32192f8cdbb1 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 4f7699aa9b31..000000000000 --- 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 f93abee43cba..000000000000 --- 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/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 000000000000..94e0ef48d0ea --- /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 d1d3300d1d63..bda74cbbe5c3 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 daa2a970c595..000000000000 --- 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/samples/Generated/Samples/Sample_ArmResourceExtensions.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_ArmResourceExtensions.cs deleted file mode 100644 index e8d81f551e21..000000000000 --- 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/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ArmResourceExtensionClient.cs deleted file mode 100644 index 6392c0823ce2..000000000000 --- 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 000000000000..ec87b37524d9 --- /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 000000000000..424fde00f239 --- /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 000000000000..dd2a55002162 --- /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 000000000000..db45c06fa846 --- /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 9a4d05980f72..000000000000 --- 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 c3b9ee6575d8..a4c48f35d9f2 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 8af0ad53a937..000000000000 --- 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 4c04aeb0ced3..000000000000 --- 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/ResourceHealthEventResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventResource.cs index 09b1556020a5..874e1c79c90f 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventResource.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ResourceHealthEventResource.cs @@ -96,7 +96,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 +114,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 +137,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/TenantResourceHealthEventResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventResource.cs index f7eae09250fd..5aadfd075801 100644 --- a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventResource.cs +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventResource.cs @@ -96,7 +96,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 +114,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 +137,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/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/Extensions/ArmClient.cs b/sdk/resourcemanager/Azure.ResourceManager/src/ManagementGroup/Generated/Extensions/ArmClient.cs index a814527cc301..efe91fb3ac3f 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 23b27abc58a1..a37ed36bd511 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/Resources/Generated/Extensions/ArmClient.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/Extensions/ArmClient.cs index 343be1099c6e..aafe5e771b67 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 deleted file mode 100644 index 17887414b18e..000000000000 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/Extensions/ArmResource.cs +++ /dev/null @@ -1,125 +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.ResourceManager.Resources; - -namespace Azure.ResourceManager -{ - public partial class ArmResource - { - /// Gets a collection of PolicyAssignmentResources in the ArmResource. - /// An object representing collection of PolicyAssignmentResources and their operations over a PolicyAssignmentResource. - public virtual PolicyAssignmentCollection GetPolicyAssignments() - { - return GetCachedClient(Client => new PolicyAssignmentCollection(Client, Id)); - } - - /// - /// This operation retrieves a single policy assignment, given its name and the scope it was created at. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName} - /// - /// - /// Operation Id - /// PolicyAssignments_Get - /// - /// - /// - /// 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. - [ForwardsClientCalls] - public virtual async Task> GetPolicyAssignmentAsync(string policyAssignmentName, CancellationToken cancellationToken = default) - { - return await GetPolicyAssignments().GetAsync(policyAssignmentName, cancellationToken).ConfigureAwait(false); - } - - /// - /// This operation retrieves a single policy assignment, given its name and the scope it was created at. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/policyAssignments/{policyAssignmentName} - /// - /// - /// Operation Id - /// PolicyAssignments_Get - /// - /// - /// - /// 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. - [ForwardsClientCalls] - public virtual Response GetPolicyAssignment(string policyAssignmentName, CancellationToken cancellationToken = default) - { - return GetPolicyAssignments().Get(policyAssignmentName, cancellationToken); - } - - /// Gets a collection of ManagementLockResources in the ArmResource. - /// An object representing collection of ManagementLockResources and their operations over a ManagementLockResource. - public virtual ManagementLockCollection GetManagementLocks() - { - return GetCachedClient(Client => new ManagementLockCollection(Client, Id)); - } - - /// - /// Get a management lock by scope. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/locks/{lockName} - /// - /// - /// Operation Id - /// ManagementLocks_GetByScope - /// - /// - /// - /// The name of lock. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public virtual async Task> GetManagementLockAsync(string lockName, CancellationToken cancellationToken = default) - { - return await GetManagementLocks().GetAsync(lockName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get a management lock by scope. - /// - /// - /// Request Path - /// /{scope}/providers/Microsoft.Authorization/locks/{lockName} - /// - /// - /// Operation Id - /// ManagementLocks_GetByScope - /// - /// - /// - /// The name of lock. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - [ForwardsClientCalls] - public virtual Response GetManagementLock(string lockName, CancellationToken cancellationToken = default) - { - return GetManagementLocks().Get(lockName, cancellationToken); - } - } -} 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 7a691d92ccde..2ec479d582f2 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/ResourceProviderResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceProviderResource.cs index ff5de33788f6..ede6faa824e9 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceProviderResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/ResourceProviderResource.cs @@ -96,7 +96,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 +114,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 +137,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/SubscriptionResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionResource.cs index 54d1b93d2d76..0476b10da0ce 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionResource.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/SubscriptionResource.cs @@ -107,7 +107,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 +126,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 +150,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 +162,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 +180,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 +203,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 +215,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 +233,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 +256,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 +268,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 +286,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 +309,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/TenantResource.cs b/sdk/resourcemanager/Azure.ResourceManager/src/Resources/Generated/TenantResource.cs index 8092739348b0..149f57bdf995 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/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 000000000000..028b4f838f1b --- /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 000000000000..7abe3ceff90b --- /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 000000000000..07710c5ea814 --- /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 000000000000..83d9ae4b2178 --- /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 feb150ce0fcf..000000000000 --- 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 0bddce4bb2d3..413fddec3c5f 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 6e266dc09c9f..000000000000 --- 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 9298aae6345c..000000000000 --- 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/MoverResourceSetResource.cs b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResourceSetResource.cs index ac3459678141..5d473a99d0e9 100644 --- a/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResourceSetResource.cs +++ b/sdk/resourcemover/Azure.ResourceManager.ResourceMover/src/Generated/MoverResourceSetResource.cs @@ -98,7 +98,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 +116,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 +139,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/src/Generated/Extensions/ManagementGroupResourceExtensionClient.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Extensions/ManagementGroupResourceExtensionClient.cs deleted file mode 100644 index cd14dcc67e1f..000000000000 --- 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 000000000000..161f2ffe9684 --- /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 000000000000..b75f833404f1 --- /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 000000000000..7610a270248a --- /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 000000000000..e8c5246fc167 --- /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 000000000000..f331b40f8310 --- /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 f4e37c164196..000000000000 --- 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 17114817c9de..b85f83cf8f24 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 40909fe4d801..000000000000 --- 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 0335edab456f..000000000000 --- 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/TemplateSpecResource.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecResource.cs index b7e0f04abb9f..53a8919eff79 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecResource.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/TemplateSpecResource.cs @@ -92,7 +92,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 +110,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 +133,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/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 000000000000..b58b36e68589 --- /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 000000000000..20eadbf0a4ab --- /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 000000000000..0872a7c381e6 --- /dev/null +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/Extensions/MockableSearchSubscriptionResource.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.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; + + /// 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 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; + } + } + } +} 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 e4fd40c1cd7b..000000000000 --- 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 9c06291ee78a..c854ea4d13fd 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); } } } 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 8c089073768a..000000000000 --- a/sdk/search/Azure.ResourceManager.Search/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.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; - - /// 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 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; - } - } - } -} diff --git a/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceResource.cs b/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceResource.cs index 9402e5eebf3f..48e23a8d0721 100644 --- a/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceResource.cs +++ b/sdk/search/Azure.ResourceManager.Search/src/Generated/SearchServiceResource.cs @@ -106,7 +106,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 +125,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 +149,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 +161,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 +180,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 +204,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/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 e901b761e526..000000000000 --- 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 000000000000..a995702f089d --- /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 000000000000..47fbb60022d0 --- /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 000000000000..edc6497f2fd8 --- /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 000000000000..8ed3fb6cf001 --- /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 31dabc523aef..000000000000 --- 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 5b462fa6c1ba..4568b0b382e6 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 bde99e4dee66..000000000000 --- 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 ed5a09bddc2d..000000000000 --- 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/IotSecuritySolutionAnalyticsModelResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsModelResource.cs index 68a56801c3fa..aeb887e2f629 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsModelResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/IotSecuritySolutionAnalyticsModelResource.cs @@ -90,7 +90,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 +108,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 +131,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 +143,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 +161,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 +184,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/RegulatoryComplianceControlResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceControlResource.cs index a26741d95031..70f0c50ef2a2 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceControlResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceControlResource.cs @@ -90,7 +90,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 +108,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 +131,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 f271c4a10e30..a53b9e09c745 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceStandardResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/RegulatoryComplianceStandardResource.cs @@ -91,7 +91,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 +109,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 +132,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/SecurityAssessmentResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAssessmentResource.cs index 89270bc272c2..197b53bbf385 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAssessmentResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityAssessmentResource.cs @@ -91,7 +91,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 +109,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 +132,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 +144,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 +162,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 +185,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/SecurityCenterLocationResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterLocationResource.cs index 9d76a610e7c7..59ece8607099 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterLocationResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityCenterLocationResource.cs @@ -118,7 +118,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 +136,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 +159,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 +171,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 +189,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 +212,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 +224,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 +242,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 +265,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/SecurityConnectorResource.cs b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorResource.cs index c88e577875ca..3df13e19f5c8 100644 --- a/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorResource.cs +++ b/sdk/securitycenter/Azure.ResourceManager.SecurityCenter/src/Generated/SecurityConnectorResource.cs @@ -92,7 +92,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 +110,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 +133,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/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsConnectorResource.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsConnectorResource.cs index ecc1412ef679..a70bac3d7506 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsConnectorResource.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsConnectorResource.cs @@ -103,7 +103,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 +121,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 +144,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 e74d2177be67..046973a9d36d 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsOrgResource.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsOrgResource.cs @@ -90,7 +90,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 +108,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 +131,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 fd28dd88590a..5202e9925c59 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsProjectResource.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/AzureDevOpsProjectResource.cs @@ -90,7 +90,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 +108,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 +131,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/Extensions/MockableSecurityDevOpsArmClient.cs b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/Extensions/MockableSecurityDevOpsArmClient.cs new file mode 100644 index 000000000000..3151c6e9d68e --- /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 000000000000..47ce93623971 --- /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 000000000000..c3ae02c36df1 --- /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 ec763b017b04..000000000000 --- 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 ac48fc5d20c2..f1c10b31679c 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 339f090321a9..000000000000 --- 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 101cc31e51a2..deccb734478c 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubConnectorResource.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubConnectorResource.cs @@ -103,7 +103,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 +121,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 +144,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 96d927437c3e..1b39fadc2616 100644 --- a/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubOwnerResource.cs +++ b/sdk/securitydevops/Azure.ResourceManager.SecurityDevOps/src/Generated/GitHubOwnerResource.cs @@ -90,7 +90,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 +108,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 +131,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/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 000000000000..e2bfb3dc62ef --- /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 000000000000..419da813b1a8 --- /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 c510da1b67e2..000000000000 --- 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 59e6473a9cd9..a817ce7b3fd3 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 4e17138e3044..0cdefd3cb2ed 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/OperationalInsightsWorkspaceSecurityInsightsResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/OperationalInsightsWorkspaceSecurityInsightsResource.cs @@ -68,7 +68,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 +86,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 +109,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 +121,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 +139,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 +162,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 +174,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 +192,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 +215,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 +227,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 +245,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 +268,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 +280,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 +298,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 +321,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 +333,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 +351,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 +374,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 +386,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 +404,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 +427,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 +439,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 +457,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 +480,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 +492,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 +510,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 +533,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 +545,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 +563,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 +586,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/SecurityInsightsAlertRuleResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleResource.cs index 90618390c009..0f9e56015790 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsAlertRuleResource.cs @@ -90,7 +90,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 +108,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 +131,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/SecurityInsightsIncidentResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentResource.cs index bd213dd82b00..4cff6bd8a7fe 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsIncidentResource.cs @@ -92,7 +92,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 +110,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 +133,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 +145,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 +163,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 +186,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/SecurityInsightsWatchlistResource.cs b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistResource.cs index fc44183f98a1..942fec690aab 100644 --- a/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistResource.cs +++ b/sdk/securityinsights/Azure.ResourceManager.SecurityInsights/src/Generated/SecurityInsightsWatchlistResource.cs @@ -90,7 +90,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 +108,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 +131,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/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 a7ff29fc7b83..000000000000 --- 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 000000000000..52a69ec8e8fd --- /dev/null +++ b/sdk/selfhelp/Azure.ResourceManager.SelfHelp/src/Generated/Extensions/MockableSelfHelpArmClient.cs @@ -0,0 +1,237 @@ +// 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 _selfHelpDiagnosticDiagnosticsClientDiagnostics; + private DiagnosticsRestOperations _selfHelpDiagnosticDiagnosticsRestClient; + 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 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 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); + } + + /// + /// 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 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 = SelfHelpDiagnosticDiagnosticsClientDiagnostics.CreateScope("MockableSelfHelpArmClient.CheckSelfHelpNameAvailability"); + scope0.Start(); + try + { + var response = await SelfHelpDiagnosticDiagnosticsRestClient.CheckNameAvailabilityAsync(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 check. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Help/checkNameAvailability + /// + /// + /// Operation Id + /// Diagnostics_CheckNameAvailability + /// + /// + /// + /// 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 = SelfHelpDiagnosticDiagnosticsClientDiagnostics.CreateScope("MockableSelfHelpArmClient.CheckSelfHelpNameAvailability"); + scope0.Start(); + try + { + var response = SelfHelpDiagnosticDiagnosticsRestClient.CheckNameAvailability(scope, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope0.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 + /// + /// + /// + /// The scope to use. + /// 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(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); + } + + /// + /// 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 + /// + /// + /// + /// The scope to use. + /// 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(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); + } + } +} 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 6014931d31f7..c48bcbda0f45 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,17 +80,21 @@ 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); } /// @@ -123,6 +109,10 @@ public static Response GetSelfHelpDiagnostic(this Ar /// Diagnostics_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -130,7 +120,7 @@ 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); } /// @@ -145,6 +135,10 @@ public static async Task> CheckSelfHelp /// Diagnostics_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. @@ -152,7 +146,7 @@ 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); } /// @@ -167,6 +161,10 @@ 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. @@ -175,7 +173,7 @@ public static Response CheckSelfHelpNameAvailabi /// 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); } /// @@ -190,6 +188,10 @@ 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. @@ -198,7 +200,23 @@ public static AsyncPageable GetSelfHelpDiscoverySoluti /// 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); } } } 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 000000000000..9e4f0d2ece2f --- /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 000000000000..fbbe0911b11d --- /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 000000000000..971fbb4633cd --- /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 6652f51f2486..000000000000 --- 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 fef5f9ebf64b..55e3f3d89184 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 d1e70e9f81de..000000000000 --- 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/ServiceBusDisasterRecoveryResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryResource.cs index 72ab87823819..ee85b4560d69 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusDisasterRecoveryResource.cs @@ -91,7 +91,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 +109,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 +132,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/ServiceBusNamespaceResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceResource.cs index 6d75e151295f..4bbcf3a831b4 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusNamespaceResource.cs @@ -110,7 +110,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 +128,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 +151,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 +163,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 +181,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 +204,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 +265,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 +283,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 +306,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 +318,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 +336,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 +359,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 +371,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 +389,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 +412,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/ServiceBusQueueResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueResource.cs index 8163b51ca37c..80ff3b29271f 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusQueueResource.cs @@ -90,7 +90,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 +108,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 +131,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/ServiceBusSubscriptionResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusSubscriptionResource.cs index fa61339166d8..2c1262e02481 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusSubscriptionResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusSubscriptionResource.cs @@ -90,7 +90,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 +108,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 +131,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/ServiceBusTopicResource.cs b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicResource.cs index fd951cfd0708..af190a9e4c86 100644 --- a/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicResource.cs +++ b/sdk/servicebus/Azure.ResourceManager.ServiceBus/src/Generated/ServiceBusTopicResource.cs @@ -90,7 +90,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 +108,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 +131,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 +143,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 +161,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 +184,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/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 000000000000..5dffcd71f936 --- /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 000000000000..818136e2663f --- /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 000000000000..5b5b5055758a --- /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 28ce17f04db2..000000000000 --- 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 bb1b205f68c4..5b411ce6efc5 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 34822c3d9aac..000000000000 --- 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 a3c166e993ba..7d4ced4a4e55 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationResource.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationResource.cs @@ -92,7 +92,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 +110,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 +133,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 f085f49c2ac1..53c0c2b62bdd 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeResource.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricApplicationTypeResource.cs @@ -91,7 +91,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 +109,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 +132,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/ServiceFabricClusterResource.cs b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricClusterResource.cs index df7de23164ac..16dc09bb8c8b 100644 --- a/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricClusterResource.cs +++ b/sdk/servicefabric/Azure.ResourceManager.ServiceFabric/src/Generated/ServiceFabricClusterResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/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 000000000000..71307359e3db --- /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 000000000000..5258f4f8945d --- /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 000000000000..b21fba357585 --- /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 31de4bc614fa..000000000000 --- 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 a0e90ab9a1f7..b1d8779ee0c8 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 16abc5487dab..000000000000 --- 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 de84ce3b3da2..813b99adc122 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationResource.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationResource.cs @@ -92,7 +92,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 +110,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 +133,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 a04764e44fea..3f399a98317f 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeResource.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedApplicationTypeResource.cs @@ -92,7 +92,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 +110,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 +133,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/ServiceFabricManagedClusterResource.cs b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedClusterResource.cs index 68004e3871cb..240884b62214 100644 --- a/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedClusterResource.cs +++ b/sdk/servicefabricmanagedclusters/Azure.ResourceManager.ServiceFabricManagedClusters/src/Generated/ServiceFabricManagedClusterResource.cs @@ -97,7 +97,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 +115,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 +138,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 +150,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 +168,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 +191,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 +203,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 +221,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 +244,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/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 940967455699..000000000000 --- 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 000000000000..659900e2dda2 --- /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 000000000000..329fcb51f95d --- /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 f1a3409e3a64..fda809c11695 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/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 000000000000..255c0e0eb687 --- /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 000000000000..8ace95a8f03f --- /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 000000000000..f6cb174ec359 --- /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 20b630f516e4..000000000000 --- 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 a15715cccf4d..c3ea9e69c9c2 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 46fbf10fb19d..000000000000 --- 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/TrafficControllerResource.cs b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerResource.cs index d5fbc6c07239..d761c6dbdb69 100644 --- a/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerResource.cs +++ b/sdk/servicenetworking/Azure.ResourceManager.ServiceNetworking/src/Generated/TrafficControllerResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/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 000000000000..9b7dc3a1bfa6 --- /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 000000000000..0e3833ec9b50 --- /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 000000000000..cfbd14a59e73 --- /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 4788d040f89d..000000000000 --- 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 351a90fc8fa1..354c8ee51e69 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 6c46ba833069..000000000000 --- 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/SignalRResource.cs b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRResource.cs index bc6fc8286e1d..09846a12138d 100644 --- a/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRResource.cs +++ b/sdk/signalr/Azure.ResourceManager.SignalR/src/Generated/SignalRResource.cs @@ -98,7 +98,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 +116,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 +139,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 +151,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 +169,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 +192,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 +204,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 +222,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 +245,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 +257,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 +275,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 +298,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/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 000000000000..a114bab6d0ba --- /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 000000000000..3fa4ce50be75 --- /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 000000000000..c62d8e3902c1 --- /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 0e9a62ddc4be..000000000000 --- 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 2440fbd67ed1..0cf0124f73c9 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 602d50e4c441..000000000000 --- 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 4602db841878..381ae1bd62ac 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCatalogResource.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereCatalogResource.cs @@ -94,7 +94,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 +112,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 +135,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 +147,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 +165,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 +188,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 +200,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 +218,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 +241,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/SphereDeviceGroupResource.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceGroupResource.cs index 703fd7b096b5..80f6a3880d8a 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceGroupResource.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereDeviceGroupResource.cs @@ -91,7 +91,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 +109,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 +132,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 +144,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 +162,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 +185,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/SphereProductResource.cs b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereProductResource.cs index b4debe9a2901..55e28557a0f0 100644 --- a/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereProductResource.cs +++ b/sdk/sphere/Azure.ResourceManager.Sphere/src/Generated/SphereProductResource.cs @@ -92,7 +92,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 +110,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 +133,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/src/Generated/Extensions/MockableSqlArmClient.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs new file mode 100644 index 000000000000..338990c9744b --- /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 000000000000..38d2f45777fc --- /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 000000000000..47d234de5f55 --- /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 d8e89b3d63a5..000000000000 --- 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 fd3093d6ab12..66bf00adace0 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 aefd96deaf4b..000000000000 --- 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/ManagedDatabaseColumnResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnResource.cs index 7e08437db91c..3a3d4c715fc2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseColumnResource.cs @@ -96,7 +96,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 c2526226ab99..079fbf669fa0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseResource.cs @@ -111,7 +111,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 +129,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 +152,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 +164,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 +213,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 +262,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 +311,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 +360,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 +409,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 +458,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 +507,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/ManagedDatabaseSchemaResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemaResource.cs index 1e2e8f0180a2..b2ac89aed278 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemaResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseSchemaResource.cs @@ -90,7 +90,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 +108,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 +131,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/ManagedDatabaseTableResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTableResource.cs index 31d4ec4eac93..9c4c771308a8 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTableResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseTableResource.cs @@ -90,7 +90,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 +108,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 +131,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 4eac801917f3..8474036bedbd 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedDatabaseVulnerabilityAssessmentResource.cs @@ -91,7 +91,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 +110,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 +134,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 +146,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 +164,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 +187,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/ManagedInstanceResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs index c258a8241a2e..bf5e1a569299 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs @@ -108,7 +108,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 +157,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 +206,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 +255,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 +273,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 +296,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 +308,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 +357,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 +375,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 +398,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 +410,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 +428,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 +451,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 +463,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 +512,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 +561,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 +579,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 +602,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 +621,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 +639,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 +662,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 +674,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 +692,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 +715,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 +727,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 +745,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 +768,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 +780,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 +798,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 +821,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 +833,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 +851,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 +874,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 +886,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 +935,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 +984,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 +1002,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 +1025,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 +1037,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 +1086,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/RestorableDroppedManagedDatabaseResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedManagedDatabaseResource.cs index cabaca176a2c..275ad6317afb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedManagedDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestorableDroppedManagedDatabaseResource.cs @@ -91,7 +91,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/SqlDatabaseAdvisorResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseAdvisorResource.cs index 5244b3a9438a..278881d9f161 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseAdvisorResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseAdvisorResource.cs @@ -90,7 +90,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 +108,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 +131,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/SqlDatabaseColumnResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseColumnResource.cs index 45d445d1d8b4..f46e0dab520d 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseColumnResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseColumnResource.cs @@ -96,7 +96,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 10983732e0e4..22623c40a72a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseResource.cs @@ -143,7 +143,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 +192,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 +210,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 +233,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 +252,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 +270,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 +293,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 +305,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 +354,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 +403,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 +452,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 +515,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 +533,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 +556,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 +568,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 +586,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 +609,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 +621,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 +639,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 +662,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 +674,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 +723,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 +772,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 +821,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 +870,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 +919,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 +937,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 +960,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 +972,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 +1021,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 7a3dd71b4bfa..e27b27a05584 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSchemaResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSchemaResource.cs @@ -90,7 +90,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 +108,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 +131,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/SqlDatabaseSqlVulnerabilityAssessmentBaselineResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineResource.cs index 4599cf5f7ffe..212d721f46c3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentBaselineResource.cs @@ -91,7 +91,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 +109,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 +132,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/SqlDatabaseSqlVulnerabilityAssessmentResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentResource.cs index 96382bf2f6f6..fe00a67c8aa3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentResource.cs @@ -95,7 +95,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 +144,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 +162,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 +185,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 bfeb096da31b..1d91accab9d7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseSqlVulnerabilityAssessmentScanResource.cs @@ -91,7 +91,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 +109,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 +132,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/SqlDatabaseTableResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseTableResource.cs index 9c32dd2a52be..74e5b9702326 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseTableResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseTableResource.cs @@ -90,7 +90,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 +108,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 +131,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 a892a39868b9..cda7c3ed0b39 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlDatabaseVulnerabilityAssessmentResource.cs @@ -91,7 +91,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 +110,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 +134,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 +146,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 +164,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 +187,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/SqlServerJobAgentResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentResource.cs index 27dd2c6d7d81..6b1ad31eae53 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobAgentResource.cs @@ -98,7 +98,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 +116,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 +139,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 +151,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 +169,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 +192,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 +204,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 +222,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 +245,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/SqlServerJobExecutionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionResource.cs index a6b80d17a5e9..a6c4ca9ce805 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionResource.cs @@ -90,7 +90,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 +108,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 +131,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 6c2e4e6ac1b9..c8e26f1278d0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobExecutionStepResource.cs @@ -90,7 +90,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/SqlServerJobResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobResource.cs index 0713e3061705..ad2700c8b975 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobResource.cs @@ -95,7 +95,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 +144,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 +162,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 +185,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 +197,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/SqlServerJobVersionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionResource.cs index 001b8264d6d7..512aff55cec3 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerJobVersionResource.cs @@ -90,7 +90,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 +108,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 +131,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/SqlServerResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs index 6cc822786c4a..36dc1a506158 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerResource.cs @@ -116,7 +116,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 +134,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 +157,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 +169,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 +187,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 +210,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 +222,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 +240,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 +263,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 +275,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 +324,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 +342,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 +365,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 +377,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 +395,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 +418,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 +430,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 +448,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 +471,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 +483,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 +501,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 +524,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 +543,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 +592,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 +641,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 +659,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 +682,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 +694,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 +712,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 +735,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 +747,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 +765,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 +788,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 +800,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 +849,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 +898,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 +916,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 +939,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 +951,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 +969,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 +992,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 +1004,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 +1022,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 +1045,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 +1057,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 +1106,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 +1155,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 +1204,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 +1253,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 +1273,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 +1298,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 +1310,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 +1328,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 +1351,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 +1363,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 +1383,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 +1408,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 +1420,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 +1440,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 +1465,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 +1477,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 +1495,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 +1518,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 +1530,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 +1579,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 +1597,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 +1620,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/SqlServerSqlVulnerabilityAssessmentBaselineResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineResource.cs index 819e0e71b282..b785e2642f58 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentBaselineResource.cs @@ -96,7 +96,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 +114,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 +137,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/SqlServerSqlVulnerabilityAssessmentResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentResource.cs index 0cf6d6c87641..b3c0923f0402 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentResource.cs @@ -100,7 +100,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 +149,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 +167,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 +190,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 7888ef6d998d..d7056425847b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SqlServerSqlVulnerabilityAssessmentScanResource.cs @@ -91,7 +91,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 +109,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 +132,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/SyncGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupResource.cs index 3612a51205af..df7dad0ec2eb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/SyncGroupResource.cs @@ -92,7 +92,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 +110,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 +133,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/WorkloadGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadGroupResource.cs index 3a4f26172005..e05ce62cda12 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/WorkloadGroupResource.cs @@ -90,7 +90,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 +108,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 +131,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/src/Generated/Extensions/MockableSqlVirtualMachineArmClient.cs b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/Extensions/MockableSqlVirtualMachineArmClient.cs new file mode 100644 index 000000000000..a3bb9fc190a5 --- /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 000000000000..0b866fd7f386 --- /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 000000000000..80a2c3d90f4d --- /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 d69906e0a11e..000000000000 --- 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 61beb79b4530..9f8e0896232c 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 67f20c2e2358..000000000000 --- 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 de52f02ba589..7162b9c40947 100644 --- a/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmGroupResource.cs +++ b/sdk/sqlvirtualmachine/Azure.ResourceManager.SqlVirtualMachine/src/Generated/SqlVmGroupResource.cs @@ -99,7 +99,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 +118,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 +142,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/storage/Azure.ResourceManager.Storage/src/Generated/BlobServiceResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobServiceResource.cs index 467a18b31000..1cba1b8173d1 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobServiceResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/BlobServiceResource.cs @@ -90,7 +90,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 +108,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 +131,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/Extensions/MockableStorageArmClient.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Extensions/MockableStorageArmClient.cs new file mode 100644 index 000000000000..09e1ec3b2729 --- /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 000000000000..b68017e2f5ce --- /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 000000000000..ab1986d9d63c --- /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 5283e3414155..000000000000 --- 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 ca92c4f28b28..13e247804bd3 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 ccb6b9722988..000000000000 --- 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 3d0509967fc3..6787359a992b 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/FileServiceResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/FileServiceResource.cs @@ -90,7 +90,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 +110,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 +135,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/QueueServiceResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/QueueServiceResource.cs index 315a9eda7d16..81a481e11a08 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/QueueServiceResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/QueueServiceResource.cs @@ -90,7 +90,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 +108,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 +131,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/StorageAccountResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountResource.cs index e363dc33f4e7..a374f058fef7 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/StorageAccountResource.cs @@ -112,7 +112,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 +130,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 +153,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 +165,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 +183,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 +206,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 +218,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 +236,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 +259,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 +271,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 +289,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 +312,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/TableServiceResource.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/TableServiceResource.cs index 4708c04ddbd0..3a112cd12fa4 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/TableServiceResource.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/TableServiceResource.cs @@ -90,7 +90,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 +108,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 +131,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/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 000000000000..ef31c9492ef8 --- /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 000000000000..3230f71b4089 --- /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 000000000000..185d6e3fb786 --- /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 62200da00892..000000000000 --- 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 43cac92f1980..69e4bacd0fa3 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 726aaed7e109..000000000000 --- 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 f656ba2a921a..1e8e996f9b43 100644 --- a/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageCacheResource.cs +++ b/sdk/storagecache/Azure.ResourceManager.StorageCache/src/Generated/StorageCacheResource.cs @@ -93,7 +93,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 +111,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 +134,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/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 000000000000..d401b1d5d6a8 --- /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 000000000000..cefd71e4920e --- /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 000000000000..e56d0323d50c --- /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 c52fbfd40f43..000000000000 --- 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 37bc4a95afa3..0c151972a0c7 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 46a2b2c0e970..000000000000 --- 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 c5373f91d5df..adcd57ffc0a6 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobDefinitionResource.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/JobDefinitionResource.cs @@ -91,7 +91,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 +109,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 +132,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/StorageMoverProjectResource.cs b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverProjectResource.cs index 4cc96b97d163..e9e181145ac2 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverProjectResource.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverProjectResource.cs @@ -91,7 +91,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 +109,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 +132,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 202d9fd9b491..89664f4cbfc9 100644 --- a/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverResource.cs +++ b/sdk/storagemover/Azure.ResourceManager.StorageMover/src/Generated/StorageMoverResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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/src/Generated/DiskPoolResource.cs b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolResource.cs index ce502d22237e..9dd6c92b79a4 100644 --- a/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolResource.cs +++ b/sdk/storagepool/Azure.ResourceManager.StoragePool/src/Generated/DiskPoolResource.cs @@ -94,7 +94,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 +112,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 +135,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 000000000000..4dcd62c8f6ee --- /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 000000000000..34b3a60f09d2 --- /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 000000000000..0eef13fbb276 --- /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 6698c42f3252..000000000000 --- 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 1b68977665fc..d6589097e40d 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 223f73b1f11a..000000000000 --- 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/src/Generated/Extensions/MockableStorageSyncArmClient.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/Extensions/MockableStorageSyncArmClient.cs new file mode 100644 index 000000000000..e2b71b3d4888 --- /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 000000000000..a20c452e8463 --- /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 000000000000..985b8935baf8 --- /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 c5274b6edc5c..000000000000 --- 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 7f0698e250c8..d7672f263118 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 e67cff5463bb..000000000000 --- 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 ded93ef8aedb..5f2454ac6cd2 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncGroupResource.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncGroupResource.cs @@ -91,7 +91,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 +109,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 +132,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 +144,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 +162,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 +185,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/StorageSyncServiceResource.cs b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServiceResource.cs index 7eeaf292079d..d11727d3bf5b 100644 --- a/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServiceResource.cs +++ b/sdk/storagesync/Azure.ResourceManager.StorageSync/src/Generated/StorageSyncServiceResource.cs @@ -98,7 +98,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 +116,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 +139,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 +151,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 +169,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 +192,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 +204,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 +253,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 +271,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 +294,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/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 000000000000..d3f92c0b2e45 --- /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 000000000000..fba5b099c0f3 --- /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 000000000000..59dd521eeac3 --- /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 84a4593d2e73..000000000000 --- 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 407a34ad7862..409e91a51ad5 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 9518ddcb0555..000000000000 --- 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 f437c5ec109f..0f01f11c94e8 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsClusterResource.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamAnalyticsClusterResource.cs @@ -94,7 +94,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 +112,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 +135,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/StreamingJobResource.cs b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobResource.cs index 50901678a975..22f3d327117d 100644 --- a/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobResource.cs +++ b/sdk/streamanalytics/Azure.ResourceManager.StreamAnalytics/src/Generated/StreamingJobResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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/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 000000000000..5176ea2bdf08 --- /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 000000000000..5e7599280e6a --- /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 000000000000..a0b5c5927388 --- /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 edb892b6dba8..6e4d0e0164d1 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 379101de0772..000000000000 --- 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 7bc08b2df639..000000000000 --- 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/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 000000000000..34abb7e56a09 --- /dev/null +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/MockableSupportArmClient.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.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 SupportTicketResource GetSupportTicketResource(ResourceIdentifier id) + { + SupportTicketResource.ValidateResourceId(id); + return new SupportTicketResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with 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); + } + } +} 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 000000000000..147904c71228 --- /dev/null +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/MockableSupportSubscriptionResource.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.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 _supportTicketClientDiagnostics; + private SupportTicketsRestOperations _supportTicketRestClient; + + /// 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 SupportTicketClientDiagnostics => _supportTicketClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Support", SupportTicketResource.ResourceType.Namespace, Diagnostics); + private SupportTicketsRestOperations SupportTicketRestClient => _supportTicketRestClient ??= new SupportTicketsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SupportTicketResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SupportTicketResources in the SubscriptionResource. + /// An object representing collection of SupportTicketResources and their operations over a SupportTicketResource. + public virtual SupportTicketCollection GetSupportTickets() + { + return GetCachedClient(client => new SupportTicketCollection(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> GetSupportTicketAsync(string supportTicketName, CancellationToken cancellationToken = default) + { + return await GetSupportTickets().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 GetSupportTicket(string supportTicketName, CancellationToken cancellationToken = default) + { + return GetSupportTickets().Get(supportTicketName, 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 = SupportTicketClientDiagnostics.CreateScope("MockableSupportSubscriptionResource.CheckSupportTicketNameAvailability"); + scope.Start(); + try + { + var response = await SupportTicketRestClient.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 = SupportTicketClientDiagnostics.CreateScope("MockableSupportSubscriptionResource.CheckSupportTicketNameAvailability"); + scope.Start(); + try + { + var response = SupportTicketRestClient.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 000000000000..ca55e649d4fa --- /dev/null +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/MockableSupportTenantResource.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.Support; + +namespace Azure.ResourceManager.Support.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableSupportTenantResource : ArmResource + { + /// 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 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); + } + } +} 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 2724e97ffaff..000000000000 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/Extensions/SubscriptionResourceExtensionClient.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.Support.Models; - -namespace Azure.ResourceManager.Support -{ - /// A class to add extension methods to SubscriptionResource. - internal partial class SubscriptionResourceExtensionClient : ArmResource - { - private ClientDiagnostics _supportTicketClientDiagnostics; - private SupportTicketsRestOperations _supportTicketRestClient; - - /// 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 SupportTicketClientDiagnostics => _supportTicketClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Support", SupportTicketResource.ResourceType.Namespace, Diagnostics); - private SupportTicketsRestOperations SupportTicketRestClient => _supportTicketRestClient ??= new SupportTicketsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SupportTicketResource.ResourceType)); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// Gets a collection of SupportTicketResources in the SubscriptionResource. - /// An object representing collection of SupportTicketResources and their operations over a SupportTicketResource. - public virtual SupportTicketCollection GetSupportTickets() - { - return GetCachedClient(Client => new SupportTicketCollection(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 = SupportTicketClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckSupportTicketNameAvailability"); - scope.Start(); - try - { - var response = await SupportTicketRestClient.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 = SupportTicketClientDiagnostics.CreateScope("SubscriptionResourceExtensionClient.CheckSupportTicketNameAvailability"); - scope.Start(); - try - { - var response = SupportTicketRestClient.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 6b245c28dabb..29cc5bf06843 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,119 +20,97 @@ 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 SupportTicketResource /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// The resource ID of the resource to get. /// Returns a object. public static SupportTicketResource GetSupportTicketResource(this ArmClient client, ResourceIdentifier id) { - return client.GetResourceClient(() => - { - SupportTicketResource.ValidateResourceId(id); - return new SupportTicketResource(client, id); - } - ); + return GetMockableSupportArmClient(client).GetSupportTicketResource(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 - /// Gets a collection of SupportTicketResources in the SubscriptionResource. + /// + /// Gets a collection of SupportTicketResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// /// The instance the method will execute against. /// An object representing collection of SupportTicketResources and their operations over a SupportTicketResource. public static SupportTicketCollection GetSupportTickets(this SubscriptionResource subscriptionResource) { - return GetSubscriptionResourceExtensionClient(subscriptionResource).GetSupportTickets(); + return GetMockableSupportSubscriptionResource(subscriptionResource).GetSupportTickets(); } /// @@ -146,16 +125,20 @@ public static SupportTicketCollection GetSupportTickets(this SubscriptionResourc /// 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> GetSupportTicketAsync(this SubscriptionResource subscriptionResource, string supportTicketName, CancellationToken cancellationToken = default) { - return await subscriptionResource.GetSupportTickets().GetAsync(supportTicketName, cancellationToken).ConfigureAwait(false); + return await GetMockableSupportSubscriptionResource(subscriptionResource).GetSupportTicketAsync(supportTicketName, cancellationToken).ConfigureAwait(false); } /// @@ -170,16 +153,20 @@ public static async Task> GetSupportTicketAsync( /// 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 GetSupportTicket(this SubscriptionResource subscriptionResource, string supportTicketName, CancellationToken cancellationToken = default) { - return subscriptionResource.GetSupportTickets().Get(supportTicketName, cancellationToken); + return GetMockableSupportSubscriptionResource(subscriptionResource).GetSupportTicket(supportTicketName, cancellationToken); } /// @@ -194,6 +181,10 @@ public static Response GetSupportTicket(this Subscription /// SupportTickets_CheckNameAvailability /// /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// /// /// The instance the method will execute against. /// Input to check. @@ -201,9 +192,7 @@ public static Response GetSupportTicket(this Subscription /// 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); } /// @@ -218,6 +207,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. @@ -225,17 +218,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(); } /// @@ -250,16 +247,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); } /// @@ -274,16 +275,20 @@ 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); } } } 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 f468488b4dd1..000000000000 --- a/sdk/support/Azure.ResourceManager.Support/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.Support -{ - /// 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 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)); - } - } -} diff --git a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportAzureServiceResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportAzureServiceResource.cs index 519f6c44777c..34c844c07c98 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportAzureServiceResource.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportAzureServiceResource.cs @@ -91,7 +91,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 +109,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 +132,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/SupportTicketResource.cs b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketResource.cs index 81b74e036e77..939833f5af16 100644 --- a/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketResource.cs +++ b/sdk/support/Azure.ResourceManager.Support/src/Generated/SupportTicketResource.cs @@ -97,7 +97,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 +115,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 +138,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) { 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 000000000000..085dfdfa418f --- /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 000000000000..471908a51188 --- /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 000000000000..76fe734fad05 --- /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 8075636c1e27..000000000000 --- 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 a48e7d51276b..000000000000 --- 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 f5cbc1dd43c6..0472ee2df0fb 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/SynapseDataMaskingPolicyResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataMaskingPolicyResource.cs index 7d784d0ab0d2..0325f4211cab 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataMaskingPolicyResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDataMaskingPolicyResource.cs @@ -90,7 +90,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 +108,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 +131,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/SynapseDatabaseResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabaseResource.cs index 11d08868d64d..4a00202940e0 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabaseResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseDatabaseResource.cs @@ -101,7 +101,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 +119,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 +142,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 +154,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 +172,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 +195,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/SynapseKustoPoolResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKustoPoolResource.cs index 937a3d380a1b..116d8a4fc99c 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKustoPoolResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseKustoPoolResource.cs @@ -106,7 +106,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 +124,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 +147,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 +159,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 +177,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 +200,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 +212,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 +230,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 +253,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/SynapsePrivateLinkHubResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkHubResource.cs index 4304d83a1a96..ee66817ddc44 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkHubResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapsePrivateLinkHubResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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/SynapseSqlPoolColumnResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolColumnResource.cs index c0a2fd94b55d..c36f184aa79e 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolColumnResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolColumnResource.cs @@ -96,7 +96,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/SynapseSqlPoolResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolResource.cs index 98d4c7988cfe..0481eea21b3e 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolResource.cs @@ -118,7 +118,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 +167,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 +216,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 +234,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 +257,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 +269,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 +287,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 +310,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 +336,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 +392,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 +410,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 +433,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 +445,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 +494,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 +543,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 +606,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 +624,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 +647,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 db9460bb216e..1c05759481f4 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSchemaResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolSchemaResource.cs @@ -90,7 +90,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 +108,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 +131,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/SynapseSqlPoolTableResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolTableResource.cs index 7df41c315989..e94528ec03b2 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolTableResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolTableResource.cs @@ -90,7 +90,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 +108,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 +131,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 3e814a675a81..d622f50c671c 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseSqlPoolVulnerabilityAssessmentResource.cs @@ -91,7 +91,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 +109,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 +132,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 +144,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 +163,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 +187,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/SynapseWorkloadGroupResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadGroupResource.cs index 82785de75f0f..1854632c062c 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadGroupResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkloadGroupResource.cs @@ -90,7 +90,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 +108,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 +131,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/SynapseWorkspaceResource.cs b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceResource.cs index 61f3185f5a7a..3ffbb3e27d34 100644 --- a/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceResource.cs +++ b/sdk/synapse/Azure.ResourceManager.Synapse/src/Generated/SynapseWorkspaceResource.cs @@ -103,7 +103,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 +152,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 +170,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 +193,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 +205,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 +223,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 +246,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 +258,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 +276,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 +299,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 +311,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 +329,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 +352,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 +364,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 +382,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 +405,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 +417,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 +466,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 +515,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 +564,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 +613,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 +662,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 +680,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 +703,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 +715,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 +733,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 +756,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 +789,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 +807,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 +830,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 +842,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 +860,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 +883,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 +895,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 +913,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 +936,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 +948,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 +967,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 +991,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 +1003,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 +1021,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 +1044,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 +1056,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 +1074,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 +1097,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/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 000000000000..c1b600cd945c --- /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 000000000000..407401526ac7 --- /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 000000000000..f101a646561a --- /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 000000000000..56ccc1cf0557 --- /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 5acd415ef629..000000000000 --- 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 d9082f7b170a..000000000000 --- 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 8ae33a4d10b3..000000000000 --- 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 eadf8eb9cabc..2437823348c4 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/TrafficManagerProfileResource.cs b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerProfileResource.cs index 550b5d8b63fb..464e3db735cd 100644 --- a/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerProfileResource.cs +++ b/sdk/trafficmanager/Azure.ResourceManager.TrafficManager/src/Generated/TrafficManagerProfileResource.cs @@ -93,7 +93,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 +112,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 +136,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 +148,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/src/Generated/Extensions/MockableVoiceServicesArmClient.cs b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/Extensions/MockableVoiceServicesArmClient.cs new file mode 100644 index 000000000000..59d543e3db95 --- /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 000000000000..ca3e19eb822f --- /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 000000000000..9efeb00e99f5 --- /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 39869e5cebc4..000000000000 --- 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 dd076a6b992b..000000000000 --- 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 da5a349f8804..d369cdda90e7 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 8b46fc37f5b7..8048ab2f8781 100644 --- a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesCommunicationsGatewayResource.cs +++ b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/src/Generated/VoiceServicesCommunicationsGatewayResource.cs @@ -93,7 +93,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 +111,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 +134,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/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 000000000000..779faedda6ed --- /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 000000000000..390b3ba9e666 --- /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 000000000000..8269c3674bca --- /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 e863b9d79eca..000000000000 --- 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 411ed6d4d4e9..000000000000 --- 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 00131a5ddfbf..cd47a9a31ed0 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/WebPubSubResource.cs b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubResource.cs index f48c72a1a171..a67962a68462 100644 --- a/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubResource.cs +++ b/sdk/webpubsub/Azure.ResourceManager.WebPubSub/src/Generated/WebPubSubResource.cs @@ -98,7 +98,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 +116,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 +139,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 +151,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 +169,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 +192,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 +204,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 +222,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 +245,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/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderResource.cs index 7dcacd87640a..545d2b7dae66 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +167,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 +193,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/AppServiceDomainResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainResource.cs index b266a7948be6..71d4ce13aff5 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainResource.cs @@ -92,7 +92,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 +110,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 +133,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 bc74773e7114..0e56bde0a665 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentResource.cs @@ -102,7 +102,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 +123,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 +149,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 +175,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 +193,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 +216,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 +228,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 +246,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 +269,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 +281,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 +301,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 +326,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/AppServicePlanResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanResource.cs index c5dd2f2c9db5..a1713ea2f305 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanResource.cs @@ -93,7 +93,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 +112,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 +136,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 +155,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 +173,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 +196,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/AppServicePlanVirtualNetworkConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionResource.cs index d24b51e5da15..0a7455fa6c8a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionResource.cs @@ -92,7 +92,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 +110,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 +133,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/Extensions/AppServiceExtensions.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/AppServiceExtensions.cs index daa9d5a45251..a26905af1132 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 000000000000..f2494c673227 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceArmClient.cs @@ -0,0 +1,1395 @@ +// 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 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 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 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); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with 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 000000000000..059948c2b124 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceResourceGroupResource.cs @@ -0,0 +1,588 @@ +// 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 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) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceHealthMetadataRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceHealthMetadataRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ResourceHealthMetadataData.DeserializeResourceHealthMetadataData, ResourceHealthMetadataClientDiagnostics, Pipeline, "MockableAppServiceResourceGroupResource.GetAllResourceHealthMetadataData", "value", "nextLink", cancellationToken); + } + + /// + /// 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) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ResourceHealthMetadataRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ResourceHealthMetadataRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ResourceHealthMetadataData.DeserializeResourceHealthMetadataData, ResourceHealthMetadataClientDiagnostics, Pipeline, "MockableAppServiceResourceGroupResource.GetAllResourceHealthMetadataData", "value", "nextLink", 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 000000000000..be74138104b9 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceSubscriptionResource.cs @@ -0,0 +1,1732 @@ +// 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 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. + /// is null. + /// 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)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListSiteIdentifiersAssignedToHostNameRequest(Id.SubscriptionId, nameIdentifier); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListSiteIdentifiersAssignedToHostNameNextPageRequest(nextLink, Id.SubscriptionId, nameIdentifier); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AppServiceIdentifierData.DeserializeAppServiceIdentifierData, DefaultClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAllSiteIdentifierData", "value", "nextLink", cancellationToken); + } + + /// + /// 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. + /// is null. + /// 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)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListSiteIdentifiersAssignedToHostNameRequest(Id.SubscriptionId, nameIdentifier); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListSiteIdentifiersAssignedToHostNameNextPageRequest(nextLink, Id.SubscriptionId, nameIdentifier); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AppServiceIdentifierData.DeserializeAppServiceIdentifierData, DefaultClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAllSiteIdentifierData", "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 000000000000..fa9ca4b4ec1d --- /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 b27c064647b3..000000000000 --- 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 46d254760391..000000000000 --- 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 8cf7bd48db70..000000000000 --- 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/SiteDiagnosticResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticResource.cs index 83a5ee8749a7..34ff716d1303 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteDiagnosticResource.cs @@ -90,7 +90,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 +108,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 +131,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 +143,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 +161,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 +184,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/SiteInstanceProcessResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessResource.cs index 6ab4188a698a..dbf1892ee3c3 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceProcessResource.cs @@ -93,7 +93,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 +111,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 +134,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 fad9077a07a3..4bb5ade6e3c6 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteInstanceResource.cs @@ -97,7 +97,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 +115,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 +138,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/SiteProcessResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessResource.cs index af893bff5e45..aeec5559d17a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteProcessResource.cs @@ -93,7 +93,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 +111,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 +134,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/SiteSlotDiagnosticResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticResource.cs index ffe76c7d42cb..21823b4b6449 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotDiagnosticResource.cs @@ -90,7 +90,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 +108,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 +131,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 +143,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 +161,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 +184,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/SiteSlotInstanceProcessResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessResource.cs index 482c68c2a347..f30296607b1d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceProcessResource.cs @@ -93,7 +93,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 +111,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 +134,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 d37c9cfc51b4..cde66a3174aa 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotInstanceResource.cs @@ -97,7 +97,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 +115,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 +138,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/SiteSlotProcessResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessResource.cs index 8ae47c3d5a70..3dc5f691a29b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotProcessResource.cs @@ -93,7 +93,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 +111,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 +134,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/SiteSlotVirtualNetworkConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionResource.cs index 90f17472bbf3..803cc96e3722 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteSlotVirtualNetworkConnectionResource.cs @@ -90,7 +90,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 +108,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 +131,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/SiteVirtualNetworkConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionResource.cs index 70be53ed3356..720d8861aa4c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/SiteVirtualNetworkConnectionResource.cs @@ -90,7 +90,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 +108,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 +131,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/StaticSiteBuildResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildResource.cs index 602fdaff1407..8f3a3fc487cc 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteBuildResource.cs @@ -92,7 +92,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 +110,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 +133,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/StaticSiteResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteResource.cs index 24ab5e43332c..fec1c126ad6e 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/StaticSiteResource.cs @@ -93,7 +93,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 +111,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 +134,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 +146,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 +164,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 +187,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 +199,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 +217,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 +240,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 +252,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 +270,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 +293,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/WebSiteConfigResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteConfigResource.cs index e4423518ae4c..6d7fc66cd32b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteConfigResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteConfigResource.cs @@ -97,7 +97,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 +115,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 +138,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/WebSiteResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteResource.cs index 31ef4b70e113..662274054da4 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteResource.cs @@ -104,7 +104,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 +125,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 +151,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 +163,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 +181,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 +204,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 +216,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 +235,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 +259,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 +271,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 +289,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 +312,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 +324,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 +342,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 +365,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 +377,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 +397,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 +422,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 +441,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 +459,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 +482,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 +494,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 +512,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 +535,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 +561,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 +579,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 +602,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 +614,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 +632,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 +655,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 +688,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 +706,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 +729,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 +741,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 +759,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 +782,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 +794,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 +812,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 +835,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 +854,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 +872,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 +895,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 +907,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 +925,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 +948,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 +960,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 +978,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 +1001,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 +1013,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 +1031,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 +1054,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 +1066,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 +1084,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 +1107,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 +1126,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 +1144,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 +1167,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 +1186,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 +1204,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 +1227,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 +1239,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 +1257,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 +1280,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 +1299,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 +1317,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 +1340,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 +1352,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 +1370,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 +1393,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/WebSiteSlotConfigResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigResource.cs index 17426bbe3caf..45c7e05d168f 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotConfigResource.cs @@ -97,7 +97,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 +115,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 +138,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/WebSiteSlotResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotResource.cs index 39ecd472b57c..aa46616076fb 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotResource.cs @@ -94,7 +94,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 +115,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 +141,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 +153,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 +171,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 +194,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 +206,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 +225,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 +249,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 +261,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 +279,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 +302,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 +314,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 +332,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 +355,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 +374,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 +392,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 +415,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 +441,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 +459,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 +482,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 +494,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 +512,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 +535,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 +561,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 +579,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 +602,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 +614,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 +632,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 +655,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 +667,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 +685,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 +708,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 +727,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 +745,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 +768,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 +780,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 +798,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 +821,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 +833,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 +851,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 +874,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 +886,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 +904,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 +927,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 +939,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 +957,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 +980,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 +999,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 +1017,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 +1040,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 +1059,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 +1077,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 +1100,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 +1112,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 +1130,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 +1153,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 +1172,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 +1190,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 +1213,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 +1232,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 +1250,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 +1273,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 +1285,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 +1303,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 +1326,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/WebSiteSlotTriggeredWebJobResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobResource.cs index fa0ee8f4c2cb..ddeb152ff680 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteSlotTriggeredWebJobResource.cs @@ -90,7 +90,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 +108,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 +131,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/WebSiteTriggeredwebJobResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredwebJobResource.cs index 5c32bee20bb0..7e3e2f14d124 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredwebJobResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/WebSiteTriggeredwebJobResource.cs @@ -90,7 +90,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 +108,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 +131,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/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 000000000000..0044a8b739d0 --- /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 000000000000..0044180d56fa --- /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 123e4331487e..000000000000 --- 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 f4ca2693506f..93a5e7946e8c 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 f73d7c4fd9fa..7aabe58a6e3d 100644 --- a/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorResource.cs +++ b/sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor/src/Generated/HealthMonitorResource.cs @@ -92,7 +92,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 +111,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 +135,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/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 000000000000..b9bf16fb4f36 --- /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 000000000000..b444d60ad520 --- /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 000000000000..f194264aa619 --- /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 2a4a6b730ed1..000000000000 --- 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 10ec8a07075a..000000000000 --- 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 951403ed3a57..56ca63e21a16 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/SapMonitorResource.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapMonitorResource.cs index 931e734039af..2f1aeaf0e654 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapMonitorResource.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapMonitorResource.cs @@ -94,7 +94,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 +112,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 +135,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/SapVirtualInstanceResource.cs b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapVirtualInstanceResource.cs index 898ef6de1223..c6633d87ee17 100644 --- a/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapVirtualInstanceResource.cs +++ b/sdk/workloads/Azure.ResourceManager.Workloads/src/Generated/SapVirtualInstanceResource.cs @@ -94,7 +94,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 +112,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 +135,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 +147,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 +165,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 +188,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 +200,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 +218,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 +241,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) {