From da78e0481f00b42b582fdea5a5b73f85475dcbf4 Mon Sep 17 00:00:00 2001 From: Kanchan Joshi <30471843+koderjoker@users.noreply.github.com> Date: Fri, 15 Dec 2023 13:41:29 +0530 Subject: [PATCH] Azure Redis .Net SDK update for new api v2023-08-01 (#39230) * Update autorest.md file with latest swagger and allow model duplication * Generate and upgrade sdk code * Customize redis common configuration code to include aad-enabled * Regenerate API file * Customize redis common configuration code to include aad-enabled * Mitigate breaking change * Create empty test-resources.json * Create FlushFunctionalTests.cs * Update assets.json * Add functional tests for aad (#2) Adds functional tests for aad * Update Channel Tests (#3) * Oscarba/fix (#4) * Update Channel Tests * Update correct data type * Push regenerated code * UpdateChannelFix (#5) * Update Channel Tests * Update correct data type * Update test * Update tag for assets after push for recordings * Address reviewer comments * Update generatred code after mergin in main * Update FTs for updated models * Update AAD FT * Update assets.json * Update changelog --------- Co-authored-by: Kanchan Joshi Co-authored-by: Austin Tolani Co-authored-by: Oscar Barbosa Aquino <32723476+Darfeikus@users.noreply.github.com> --- .../Azure.ResourceManager.Redis/CHANGELOG.md | 11 +- ...re.ResourceManager.Redis.netstandard2.0.cs | 180 +++++++ .../Azure.ResourceManager.Redis/assets.json | 2 +- ...isCacheAccessPolicyAssignmentCollection.cs | 208 ++++++++ ...edisCacheAccessPolicyAssignmentResource.cs | 119 +++++ ...Sample_RedisCacheAccessPolicyCollection.cs | 206 ++++++++ .../Sample_RedisCacheAccessPolicyResource.cs | 117 +++++ .../Samples/Sample_RedisCollection.cs | 14 +- .../Sample_RedisFirewallRuleCollection.cs | 10 +- .../Sample_RedisFirewallRuleResource.cs | 6 +- ...RedisLinkedServerWithPropertyCollection.cs | 10 +- ...e_RedisLinkedServerWithPropertyResource.cs | 6 +- .../Sample_RedisPatchScheduleCollection.cs | 10 +- .../Sample_RedisPatchScheduleResource.cs | 6 +- ...edisPrivateEndpointConnectionCollection.cs | 10 +- ..._RedisPrivateEndpointConnectionResource.cs | 6 +- .../Generated/Samples/Sample_RedisResource.cs | 53 ++- .../Sample_SubscriptionResourceExtensions.cs | 2 +- .../src/Customization/ArmRedisModelFactory.cs | 95 ++++ .../RedisCommonConfiguration.Serialization.cs | 13 +- .../src/Generated/ArmRedisModelFactory.cs | 39 +- .../Extensions/MockableRedisArmClient.cs | 24 + .../Generated/Extensions/RedisExtensions.cs | 38 ++ .../OperationStatusResultOperationSource.cs | 31 ++ ...heAccessPolicyAssignmentOperationSource.cs | 40 ++ .../RedisCacheAccessPolicyOperationSource.cs | 40 ++ ...AccessPolicyAssignmentProvisioningState.cs | 63 +++ .../Models/AccessPolicyProvisioningState.cs | 63 +++ .../src/Generated/Models/AccessPolicyType.cs | 51 ++ ...ccessPolicyAssignmentData.Serialization.cs | 126 +++++ ...ccessPolicyAssignmentList.Serialization.cs | 50 ++ .../RedisCacheAccessPolicyAssignmentList.cs | 37 ++ ...edisCacheAccessPolicyData.Serialization.cs | 109 +++++ ...edisCacheAccessPolicyList.Serialization.cs | 50 ++ .../Models/RedisCacheAccessPolicyList.cs | 37 ++ .../Models/RedisCommonConfiguration.cs | 6 +- ...edisCreateOrUpdateContent.Serialization.cs | 5 + .../Models/RedisCreateOrUpdateContent.cs | 6 +- .../Models/RedisData.Serialization.cs | 17 +- .../Models/RedisPatch.Serialization.cs | 5 + .../src/Generated/Models/RedisPatch.cs | 6 +- .../Models/RedisProvisioningState.cs | 3 + .../src/Generated/Models/UpdateChannel.cs | 51 ++ ...isCacheAccessPolicyAssignmentCollection.cs | 415 ++++++++++++++++ .../RedisCacheAccessPolicyAssignmentData.cs | 52 ++ ...edisCacheAccessPolicyAssignmentResource.cs | 301 ++++++++++++ .../RedisCacheAccessPolicyCollection.cs | 415 ++++++++++++++++ .../Generated/RedisCacheAccessPolicyData.cs | 47 ++ .../RedisCacheAccessPolicyResource.cs | 301 ++++++++++++ .../src/Generated/RedisData.cs | 6 +- .../src/Generated/RedisResource.cs | 175 +++++++ .../AccessPolicyAssignmentRestOperations.cs | 445 ++++++++++++++++++ .../AccessPolicyRestOperations.cs | 445 ++++++++++++++++++ .../AsyncOperationStatusRestOperations.cs | 6 +- .../FirewallRulesRestOperations.cs | 42 +- .../LinkedServerRestOperations.cs | 42 +- .../PatchSchedulesRestOperations.cs | 42 +- ...rivateEndpointConnectionsRestOperations.cs | 34 +- .../PrivateLinkResourcesRestOperations.cs | 10 +- .../RestOperations/RedisRestOperations.cs | 189 +++++--- .../src/autorest.md | 5 +- .../tests/ScenarioTests/AadFunctionalTests.cs | 146 ++++++ .../ScenarioTests/FlushFunctionalTests.cs | 56 +++ .../UpdateChannelFunctionalTests.cs | 62 +++ sdk/redis/test-resources.json | 6 + 65 files changed, 5005 insertions(+), 218 deletions(-) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentCollection.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentResource.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyCollection.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyResource.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Customization/ArmRedisModelFactory.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/OperationStatusResultOperationSource.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisCacheAccessPolicyAssignmentOperationSource.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisCacheAccessPolicyOperationSource.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyAssignmentProvisioningState.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyProvisioningState.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyType.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentData.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyData.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpdateChannel.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentCollection.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentResource.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyCollection.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyResource.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AccessPolicyAssignmentRestOperations.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AccessPolicyRestOperations.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/ScenarioTests/AadFunctionalTests.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/ScenarioTests/FlushFunctionalTests.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/ScenarioTests/UpdateChannelFunctionalTests.cs create mode 100644 sdk/redis/test-resources.json diff --git a/sdk/redis/Azure.ResourceManager.Redis/CHANGELOG.md b/sdk/redis/Azure.ResourceManager.Redis/CHANGELOG.md index 280b2ea7703dd..0cdb3e5bfa63b 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/CHANGELOG.md +++ b/sdk/redis/Azure.ResourceManager.Redis/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 1.3.0-beta.1 (Unreleased) +## 1.3.0-beta.1 (2023-12-15) ### Features Added - -### Breaking Changes - -### Bugs Fixed - -### Other Changes + - Adds support for using Microsoft Entra token-based authentication for your Azure Cache for Redis instance + - Adds support to choose an update channel + - Adds support the flush data operation to delete or flush all data in your cache ## 1.2.1 (2023-11-30) diff --git a/sdk/redis/Azure.ResourceManager.Redis/api/Azure.ResourceManager.Redis.netstandard2.0.cs b/sdk/redis/Azure.ResourceManager.Redis/api/Azure.ResourceManager.Redis.netstandard2.0.cs index 6eb8fbb3ce9d9..85fa7565657c8 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/api/Azure.ResourceManager.Redis.netstandard2.0.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/api/Azure.ResourceManager.Redis.netstandard2.0.cs @@ -1,5 +1,82 @@ namespace Azure.ResourceManager.Redis { + public partial class RedisCacheAccessPolicyAssignmentCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected RedisCacheAccessPolicyAssignmentCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string accessPolicyAssignmentName, Azure.ResourceManager.Redis.RedisCacheAccessPolicyAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string accessPolicyAssignmentName, Azure.ResourceManager.Redis.RedisCacheAccessPolicyAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string accessPolicyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string accessPolicyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string accessPolicyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string accessPolicyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string accessPolicyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string accessPolicyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class RedisCacheAccessPolicyAssignmentData : Azure.ResourceManager.Models.ResourceData + { + public RedisCacheAccessPolicyAssignmentData() { } + public string AccessPolicyName { get { throw null; } set { } } + public System.Guid? ObjectId { get { throw null; } set { } } + public string ObjectIdAlias { get { throw null; } set { } } + public Azure.ResourceManager.Redis.Models.AccessPolicyAssignmentProvisioningState? ProvisioningState { get { throw null; } } + } + public partial class RedisCacheAccessPolicyAssignmentResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected RedisCacheAccessPolicyAssignmentResource() { } + public virtual Azure.ResourceManager.Redis.RedisCacheAccessPolicyAssignmentData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.RedisCacheAccessPolicyAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.RedisCacheAccessPolicyAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class RedisCacheAccessPolicyCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected RedisCacheAccessPolicyCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string accessPolicyName, Azure.ResourceManager.Redis.RedisCacheAccessPolicyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string accessPolicyName, Azure.ResourceManager.Redis.RedisCacheAccessPolicyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string accessPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string accessPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string accessPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string accessPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string accessPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string accessPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class RedisCacheAccessPolicyData : Azure.ResourceManager.Models.ResourceData + { + public RedisCacheAccessPolicyData() { } + public string Permissions { get { throw null; } set { } } + public Azure.ResourceManager.Redis.Models.AccessPolicyProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.Redis.Models.AccessPolicyType? TypePropertiesType { get { throw null; } } + } + public partial class RedisCacheAccessPolicyResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected RedisCacheAccessPolicyResource() { } + public virtual Azure.ResourceManager.Redis.RedisCacheAccessPolicyData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.RedisCacheAccessPolicyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.RedisCacheAccessPolicyData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } public partial class RedisCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected RedisCollection() { } @@ -41,6 +118,7 @@ public RedisData(Azure.Core.AzureLocation location, Azure.ResourceManager.Redis. public System.Net.IPAddress StaticIP { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } public System.Collections.Generic.IDictionary TenantSettings { get { throw null; } } + public Azure.ResourceManager.Redis.Models.UpdateChannel? UpdateChannel { get { throw null; } set { } } public System.Collections.Generic.IList Zones { get { throw null; } } } public static partial class RedisExtensions @@ -54,6 +132,8 @@ public static partial class RedisExtensions public static System.Threading.Tasks.Task> GetAsyncOperationStatusAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Response GetRedis(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetRedisAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Redis.RedisCacheAccessPolicyAssignmentResource GetRedisCacheAccessPolicyAssignmentResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Redis.RedisCacheAccessPolicyResource GetRedisCacheAccessPolicyResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Redis.RedisFirewallRuleResource GetRedisFirewallRuleResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Redis.RedisLinkedServerWithPropertyResource GetRedisLinkedServerWithPropertyResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Redis.RedisPatchScheduleResource GetRedisPatchScheduleResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } @@ -226,6 +306,8 @@ protected RedisResource() { } public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.ArmOperation ExportData(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.Models.ExportRdbContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ExportDataAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.Models.ExportRdbContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation FlushCache(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> FlushCacheAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response ForceReboot(Azure.ResourceManager.Redis.Models.RedisRebootContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> ForceRebootAsync(Azure.ResourceManager.Redis.Models.RedisRebootContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -234,6 +316,12 @@ protected RedisResource() { } public virtual System.Threading.Tasks.Task> GetKeysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetPrivateLinkResourcesByRedisCache(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetPrivateLinkResourcesByRedisCacheAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Redis.RedisCacheAccessPolicyCollection GetRedisCacheAccessPolicies() { throw null; } + public virtual Azure.Response GetRedisCacheAccessPolicy(string accessPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRedisCacheAccessPolicyAssignment(string accessPolicyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRedisCacheAccessPolicyAssignmentAsync(string accessPolicyAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Redis.RedisCacheAccessPolicyAssignmentCollection GetRedisCacheAccessPolicyAssignments() { throw null; } + public virtual System.Threading.Tasks.Task> GetRedisCacheAccessPolicyAsync(string accessPolicyName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetRedisFirewallRule(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetRedisFirewallRuleAsync(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Redis.RedisFirewallRuleCollection GetRedisFirewallRules() { throw null; } @@ -271,6 +359,8 @@ namespace Azure.ResourceManager.Redis.Mocking public partial class MockableRedisArmClient : Azure.ResourceManager.ArmResource { protected MockableRedisArmClient() { } + public virtual Azure.ResourceManager.Redis.RedisCacheAccessPolicyAssignmentResource GetRedisCacheAccessPolicyAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Redis.RedisCacheAccessPolicyResource GetRedisCacheAccessPolicyResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Redis.RedisFirewallRuleResource GetRedisFirewallRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Redis.RedisLinkedServerWithPropertyResource GetRedisLinkedServerWithPropertyResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.Redis.RedisPatchScheduleResource GetRedisPatchScheduleResource(Azure.Core.ResourceIdentifier id) { throw null; } @@ -297,11 +387,79 @@ protected MockableRedisSubscriptionResource() { } } namespace Azure.ResourceManager.Redis.Models { + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AccessPolicyAssignmentProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AccessPolicyAssignmentProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.Redis.Models.AccessPolicyAssignmentProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.AccessPolicyAssignmentProvisioningState Deleted { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.AccessPolicyAssignmentProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.AccessPolicyAssignmentProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.AccessPolicyAssignmentProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.AccessPolicyAssignmentProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.Redis.Models.AccessPolicyAssignmentProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Redis.Models.AccessPolicyAssignmentProvisioningState left, Azure.ResourceManager.Redis.Models.AccessPolicyAssignmentProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.Redis.Models.AccessPolicyAssignmentProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Redis.Models.AccessPolicyAssignmentProvisioningState left, Azure.ResourceManager.Redis.Models.AccessPolicyAssignmentProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AccessPolicyProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AccessPolicyProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.Redis.Models.AccessPolicyProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.AccessPolicyProvisioningState Deleted { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.AccessPolicyProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.AccessPolicyProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.AccessPolicyProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.AccessPolicyProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.Redis.Models.AccessPolicyProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Redis.Models.AccessPolicyProvisioningState left, Azure.ResourceManager.Redis.Models.AccessPolicyProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.Redis.Models.AccessPolicyProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Redis.Models.AccessPolicyProvisioningState left, Azure.ResourceManager.Redis.Models.AccessPolicyProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AccessPolicyType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AccessPolicyType(string value) { throw null; } + public static Azure.ResourceManager.Redis.Models.AccessPolicyType BuiltIn { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.AccessPolicyType Custom { get { throw null; } } + public bool Equals(Azure.ResourceManager.Redis.Models.AccessPolicyType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Redis.Models.AccessPolicyType left, Azure.ResourceManager.Redis.Models.AccessPolicyType right) { throw null; } + public static implicit operator Azure.ResourceManager.Redis.Models.AccessPolicyType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Redis.Models.AccessPolicyType left, Azure.ResourceManager.Redis.Models.AccessPolicyType right) { throw null; } + public override string ToString() { throw null; } + } public static partial class ArmRedisModelFactory { public static Azure.ResourceManager.Redis.Models.RedisAccessKeys RedisAccessKeys(string primaryKey = null, string secondaryKey = null) { throw null; } + public static Azure.ResourceManager.Redis.RedisCacheAccessPolicyAssignmentData RedisCacheAccessPolicyAssignmentData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Redis.Models.AccessPolicyAssignmentProvisioningState? provisioningState = default(Azure.ResourceManager.Redis.Models.AccessPolicyAssignmentProvisioningState?), System.Guid? objectId = default(System.Guid?), string objectIdAlias = null, string accessPolicyName = null) { throw null; } + public static Azure.ResourceManager.Redis.RedisCacheAccessPolicyData RedisCacheAccessPolicyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Redis.Models.AccessPolicyProvisioningState? provisioningState = default(Azure.ResourceManager.Redis.Models.AccessPolicyProvisioningState?), Azure.ResourceManager.Redis.Models.AccessPolicyType? typePropertiesType = default(Azure.ResourceManager.Redis.Models.AccessPolicyType?), string permissions = null) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static Azure.ResourceManager.Redis.Models.RedisCommonConfiguration RedisCommonConfiguration(bool? isRdbBackupEnabled = default(bool?), string rdbBackupFrequency = null, int? rdbBackupMaxSnapshotCount = default(int?), string rdbStorageConnectionString = null, bool? isAofBackupEnabled = default(bool?), string aofStorageConnectionString0 = null, string aofStorageConnectionString1 = null, string maxFragmentationMemoryReserved = null, string maxMemoryPolicy = null, string maxMemoryReserved = null, string maxMemoryDelta = null, string maxClients = null, string preferredDataArchiveAuthMethod = null, string preferredDataPersistenceAuthMethod = null, string zonalConfiguration = null, string authNotRequired = null, string storageSubscriptionId = null, System.Collections.Generic.IDictionary additionalProperties = null) { throw null; } + public static Azure.ResourceManager.Redis.Models.RedisCommonConfiguration RedisCommonConfiguration(bool? isRdbBackupEnabled = default(bool?), string rdbBackupFrequency = null, int? rdbBackupMaxSnapshotCount = default(int?), string rdbStorageConnectionString = null, bool? isAofBackupEnabled = default(bool?), string aofStorageConnectionString0 = null, string aofStorageConnectionString1 = null, string maxFragmentationMemoryReserved = null, string maxMemoryPolicy = null, string maxMemoryReserved = null, string maxMemoryDelta = null, string maxClients = null, string preferredDataArchiveAuthMethod = null, string preferredDataPersistenceAuthMethod = null, string zonalConfiguration = null, string authNotRequired = null, string storageSubscriptionId = null, string isAadEnabled = null, System.Collections.Generic.IDictionary additionalProperties = null) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static Azure.ResourceManager.Redis.RedisData RedisData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Collections.Generic.IEnumerable zones = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.Redis.Models.RedisCommonConfiguration redisConfiguration = null, string redisVersion = null, bool? enableNonSslPort = default(bool?), int? replicasPerMaster = default(int?), int? replicasPerPrimary = default(int?), System.Collections.Generic.IDictionary tenantSettings = null, int? shardCount = default(int?), Azure.ResourceManager.Redis.Models.RedisTlsVersion? minimumTlsVersion = default(Azure.ResourceManager.Redis.Models.RedisTlsVersion?), Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess?), Azure.ResourceManager.Redis.Models.RedisSku sku = null, Azure.Core.ResourceIdentifier subnetId = null, System.Net.IPAddress staticIP = null, Azure.ResourceManager.Redis.Models.RedisProvisioningState? provisioningState = default(Azure.ResourceManager.Redis.Models.RedisProvisioningState?), string hostName = null, int? port = default(int?), int? sslPort = default(int?), Azure.ResourceManager.Redis.Models.RedisAccessKeys accessKeys = null, System.Collections.Generic.IEnumerable linkedServers = null, System.Collections.Generic.IEnumerable instances = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null) { throw null; } + public static Azure.ResourceManager.Redis.RedisData RedisData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Collections.Generic.IEnumerable zones = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.Redis.Models.RedisCommonConfiguration redisConfiguration = null, string redisVersion = null, bool? enableNonSslPort = default(bool?), int? replicasPerMaster = default(int?), int? replicasPerPrimary = default(int?), System.Collections.Generic.IDictionary tenantSettings = null, int? shardCount = default(int?), Azure.ResourceManager.Redis.Models.RedisTlsVersion? minimumTlsVersion = default(Azure.ResourceManager.Redis.Models.RedisTlsVersion?), Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess?), Azure.ResourceManager.Redis.Models.UpdateChannel? updateChannel = default(Azure.ResourceManager.Redis.Models.UpdateChannel?), Azure.ResourceManager.Redis.Models.RedisSku sku = null, Azure.Core.ResourceIdentifier subnetId = null, System.Net.IPAddress staticIP = null, Azure.ResourceManager.Redis.Models.RedisProvisioningState? provisioningState = default(Azure.ResourceManager.Redis.Models.RedisProvisioningState?), string hostName = null, int? port = default(int?), int? sslPort = default(int?), Azure.ResourceManager.Redis.Models.RedisAccessKeys accessKeys = null, System.Collections.Generic.IEnumerable linkedServers = null, System.Collections.Generic.IEnumerable instances = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null) { throw null; } public static Azure.ResourceManager.Redis.RedisFirewallRuleData RedisFirewallRuleData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Net.IPAddress startIP = null, System.Net.IPAddress endIP = null) { throw null; } public static Azure.ResourceManager.Redis.Models.RedisForceRebootResult RedisForceRebootResult(string message = null) { throw null; } public static Azure.ResourceManager.Redis.Models.RedisInstanceDetails RedisInstanceDetails(int? sslPort = default(int?), int? nonSslPort = default(int?), string zone = null, int? shardId = default(int?), bool? isMaster = default(bool?), bool? isPrimary = default(bool?)) { throw null; } @@ -342,6 +500,7 @@ public RedisCommonConfiguration() { } public string AofStorageConnectionString0 { get { throw null; } set { } } public string AofStorageConnectionString1 { get { throw null; } set { } } public string AuthNotRequired { get { throw null; } set { } } + public string IsAadEnabled { get { throw null; } set { } } public bool? IsAofBackupEnabled { get { throw null; } set { } } public bool? IsRdbBackupEnabled { get { throw null; } set { } } public string MaxClients { get { throw null; } } @@ -375,6 +534,7 @@ public RedisCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.Resou public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } public System.Collections.Generic.IDictionary TenantSettings { get { throw null; } } + public Azure.ResourceManager.Redis.Models.UpdateChannel? UpdateChannel { get { throw null; } set { } } public System.Collections.Generic.IList Zones { get { throw null; } } } public enum RedisDayOfWeek @@ -444,6 +604,7 @@ public RedisPatch() { } public Azure.ResourceManager.Redis.Models.RedisSku Sku { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } public System.Collections.Generic.IDictionary TenantSettings { get { throw null; } } + public Azure.ResourceManager.Redis.Models.UpdateChannel? UpdateChannel { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct RedisPatchScheduleDefaultName : System.IEquatable @@ -528,6 +689,7 @@ public RedisPrivateLinkServiceConnectionState() { } private readonly object _dummy; private readonly int _dummyPrimitive; public RedisProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.Redis.Models.RedisProvisioningState ConfiguringAAD { get { throw null; } } public static Azure.ResourceManager.Redis.Models.RedisProvisioningState Creating { get { throw null; } } public static Azure.ResourceManager.Redis.Models.RedisProvisioningState Deleting { get { throw null; } } public static Azure.ResourceManager.Redis.Models.RedisProvisioningState Disabled { get { throw null; } } @@ -674,4 +836,22 @@ internal RedisUpgradeNotification() { } public System.DateTimeOffset? Timestamp { get { throw null; } } public System.Collections.Generic.IReadOnlyDictionary UpsellNotification { get { throw null; } } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct UpdateChannel : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public UpdateChannel(string value) { throw null; } + public static Azure.ResourceManager.Redis.Models.UpdateChannel Preview { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.UpdateChannel Stable { get { throw null; } } + public bool Equals(Azure.ResourceManager.Redis.Models.UpdateChannel other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Redis.Models.UpdateChannel left, Azure.ResourceManager.Redis.Models.UpdateChannel right) { throw null; } + public static implicit operator Azure.ResourceManager.Redis.Models.UpdateChannel (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Redis.Models.UpdateChannel left, Azure.ResourceManager.Redis.Models.UpdateChannel right) { throw null; } + public override string ToString() { throw null; } + } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/assets.json b/sdk/redis/Azure.ResourceManager.Redis/assets.json index e1594d83eca8f..1bec81d556c9b 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/assets.json +++ b/sdk/redis/Azure.ResourceManager.Redis/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/redis/Azure.ResourceManager.Redis", - "Tag": "net/redis/Azure.ResourceManager.Redis_40dabd49d3" + "Tag": "net/redis/Azure.ResourceManager.Redis_73d38d0d17" } diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentCollection.cs new file mode 100644 index 0000000000000..0a9eb7f82f6fc --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentCollection.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Redis; + +namespace Azure.ResourceManager.Redis.Samples +{ + public partial class Sample_RedisCacheAccessPolicyAssignmentCollection + { + // RedisCacheAccessPolicyAssignmentCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_RedisCacheAccessPolicyAssignmentCreateUpdate() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentCreateUpdate.json + // this example is just showing the usage of "AccessPolicyAssignment_CreateUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisResource created on azure + // for more information of creating RedisResource, please refer to the document of RedisResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); + RedisResource redis = client.GetRedisResource(redisResourceId); + + // get the collection of this RedisCacheAccessPolicyAssignmentResource + RedisCacheAccessPolicyAssignmentCollection collection = redis.GetRedisCacheAccessPolicyAssignments(); + + // invoke the operation + string accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + RedisCacheAccessPolicyAssignmentData data = new RedisCacheAccessPolicyAssignmentData() + { + ObjectId = Guid.Parse("6497c918-11ad-41e7-1b0f-7c518a87d0b0"), + ObjectIdAlias = "TestAADAppRedis", + AccessPolicyName = "accessPolicy1", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, accessPolicyAssignmentName, data); + RedisCacheAccessPolicyAssignmentResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RedisCacheAccessPolicyAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // RedisCacheAccessPolicyAssignmentGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_RedisCacheAccessPolicyAssignmentGet() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentGet.json + // this example is just showing the usage of "AccessPolicyAssignment_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisResource created on azure + // for more information of creating RedisResource, please refer to the document of RedisResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); + RedisResource redis = client.GetRedisResource(redisResourceId); + + // get the collection of this RedisCacheAccessPolicyAssignmentResource + RedisCacheAccessPolicyAssignmentCollection collection = redis.GetRedisCacheAccessPolicyAssignments(); + + // invoke the operation + string accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + RedisCacheAccessPolicyAssignmentResource result = await collection.GetAsync(accessPolicyAssignmentName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RedisCacheAccessPolicyAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // RedisCacheAccessPolicyAssignmentGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_RedisCacheAccessPolicyAssignmentGet() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentGet.json + // this example is just showing the usage of "AccessPolicyAssignment_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisResource created on azure + // for more information of creating RedisResource, please refer to the document of RedisResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); + RedisResource redis = client.GetRedisResource(redisResourceId); + + // get the collection of this RedisCacheAccessPolicyAssignmentResource + RedisCacheAccessPolicyAssignmentCollection collection = redis.GetRedisCacheAccessPolicyAssignments(); + + // invoke the operation + string accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + bool result = await collection.ExistsAsync(accessPolicyAssignmentName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // RedisCacheAccessPolicyAssignmentGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RedisCacheAccessPolicyAssignmentGet() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentGet.json + // this example is just showing the usage of "AccessPolicyAssignment_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisResource created on azure + // for more information of creating RedisResource, please refer to the document of RedisResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); + RedisResource redis = client.GetRedisResource(redisResourceId); + + // get the collection of this RedisCacheAccessPolicyAssignmentResource + RedisCacheAccessPolicyAssignmentCollection collection = redis.GetRedisCacheAccessPolicyAssignments(); + + // invoke the operation + string accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + NullableResponse response = await collection.GetIfExistsAsync(accessPolicyAssignmentName); + RedisCacheAccessPolicyAssignmentResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RedisCacheAccessPolicyAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // RedisCacheAccessPolicyAssignmentList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_RedisCacheAccessPolicyAssignmentList() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentList.json + // this example is just showing the usage of "AccessPolicyAssignment_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisResource created on azure + // for more information of creating RedisResource, please refer to the document of RedisResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); + RedisResource redis = client.GetRedisResource(redisResourceId); + + // get the collection of this RedisCacheAccessPolicyAssignmentResource + RedisCacheAccessPolicyAssignmentCollection collection = redis.GetRedisCacheAccessPolicyAssignments(); + + // invoke the operation and iterate over the result + await foreach (RedisCacheAccessPolicyAssignmentResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RedisCacheAccessPolicyAssignmentData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentResource.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentResource.cs new file mode 100644 index 0000000000000..ad8c4182e4e84 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentResource.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Redis; + +namespace Azure.ResourceManager.Redis.Samples +{ + public partial class Sample_RedisCacheAccessPolicyAssignmentResource + { + // RedisCacheAccessPolicyAssignmentCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_RedisCacheAccessPolicyAssignmentCreateUpdate() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentCreateUpdate.json + // this example is just showing the usage of "AccessPolicyAssignment_CreateUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisCacheAccessPolicyAssignmentResource created on azure + // for more information of creating RedisCacheAccessPolicyAssignmentResource, please refer to the document of RedisCacheAccessPolicyAssignmentResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + string accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + ResourceIdentifier redisCacheAccessPolicyAssignmentResourceId = RedisCacheAccessPolicyAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName); + RedisCacheAccessPolicyAssignmentResource redisCacheAccessPolicyAssignment = client.GetRedisCacheAccessPolicyAssignmentResource(redisCacheAccessPolicyAssignmentResourceId); + + // invoke the operation + RedisCacheAccessPolicyAssignmentData data = new RedisCacheAccessPolicyAssignmentData() + { + ObjectId = Guid.Parse("6497c918-11ad-41e7-1b0f-7c518a87d0b0"), + ObjectIdAlias = "TestAADAppRedis", + AccessPolicyName = "accessPolicy1", + }; + ArmOperation lro = await redisCacheAccessPolicyAssignment.UpdateAsync(WaitUntil.Completed, data); + RedisCacheAccessPolicyAssignmentResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RedisCacheAccessPolicyAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // RedisCacheAccessPolicyAssignmentDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_RedisCacheAccessPolicyAssignmentDelete() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentDelete.json + // this example is just showing the usage of "AccessPolicyAssignment_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisCacheAccessPolicyAssignmentResource created on azure + // for more information of creating RedisCacheAccessPolicyAssignmentResource, please refer to the document of RedisCacheAccessPolicyAssignmentResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + string accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + ResourceIdentifier redisCacheAccessPolicyAssignmentResourceId = RedisCacheAccessPolicyAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName); + RedisCacheAccessPolicyAssignmentResource redisCacheAccessPolicyAssignment = client.GetRedisCacheAccessPolicyAssignmentResource(redisCacheAccessPolicyAssignmentResourceId); + + // invoke the operation + await redisCacheAccessPolicyAssignment.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // RedisCacheAccessPolicyAssignmentGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_RedisCacheAccessPolicyAssignmentGet() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyAssignmentGet.json + // this example is just showing the usage of "AccessPolicyAssignment_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisCacheAccessPolicyAssignmentResource created on azure + // for more information of creating RedisCacheAccessPolicyAssignmentResource, please refer to the document of RedisCacheAccessPolicyAssignmentResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + string accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + ResourceIdentifier redisCacheAccessPolicyAssignmentResourceId = RedisCacheAccessPolicyAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName); + RedisCacheAccessPolicyAssignmentResource redisCacheAccessPolicyAssignment = client.GetRedisCacheAccessPolicyAssignmentResource(redisCacheAccessPolicyAssignmentResourceId); + + // invoke the operation + RedisCacheAccessPolicyAssignmentResource result = await redisCacheAccessPolicyAssignment.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RedisCacheAccessPolicyAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyCollection.cs new file mode 100644 index 0000000000000..412ee02182cf4 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyCollection.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Redis; + +namespace Azure.ResourceManager.Redis.Samples +{ + public partial class Sample_RedisCacheAccessPolicyCollection + { + // RedisCacheAccessPolicyCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_RedisCacheAccessPolicyCreateUpdate() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyCreateUpdate.json + // this example is just showing the usage of "AccessPolicy_CreateUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisResource created on azure + // for more information of creating RedisResource, please refer to the document of RedisResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); + RedisResource redis = client.GetRedisResource(redisResourceId); + + // get the collection of this RedisCacheAccessPolicyResource + RedisCacheAccessPolicyCollection collection = redis.GetRedisCacheAccessPolicies(); + + // invoke the operation + string accessPolicyName = "accessPolicy1"; + RedisCacheAccessPolicyData data = new RedisCacheAccessPolicyData() + { + Permissions = "+get +hget", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, accessPolicyName, data); + RedisCacheAccessPolicyResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RedisCacheAccessPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // RedisCacheAccessPolicyGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_RedisCacheAccessPolicyGet() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyGet.json + // this example is just showing the usage of "AccessPolicy_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisResource created on azure + // for more information of creating RedisResource, please refer to the document of RedisResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); + RedisResource redis = client.GetRedisResource(redisResourceId); + + // get the collection of this RedisCacheAccessPolicyResource + RedisCacheAccessPolicyCollection collection = redis.GetRedisCacheAccessPolicies(); + + // invoke the operation + string accessPolicyName = "accessPolicy1"; + RedisCacheAccessPolicyResource result = await collection.GetAsync(accessPolicyName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RedisCacheAccessPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // RedisCacheAccessPolicyGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_RedisCacheAccessPolicyGet() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyGet.json + // this example is just showing the usage of "AccessPolicy_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisResource created on azure + // for more information of creating RedisResource, please refer to the document of RedisResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); + RedisResource redis = client.GetRedisResource(redisResourceId); + + // get the collection of this RedisCacheAccessPolicyResource + RedisCacheAccessPolicyCollection collection = redis.GetRedisCacheAccessPolicies(); + + // invoke the operation + string accessPolicyName = "accessPolicy1"; + bool result = await collection.ExistsAsync(accessPolicyName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // RedisCacheAccessPolicyGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_RedisCacheAccessPolicyGet() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyGet.json + // this example is just showing the usage of "AccessPolicy_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisResource created on azure + // for more information of creating RedisResource, please refer to the document of RedisResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); + RedisResource redis = client.GetRedisResource(redisResourceId); + + // get the collection of this RedisCacheAccessPolicyResource + RedisCacheAccessPolicyCollection collection = redis.GetRedisCacheAccessPolicies(); + + // invoke the operation + string accessPolicyName = "accessPolicy1"; + NullableResponse response = await collection.GetIfExistsAsync(accessPolicyName); + RedisCacheAccessPolicyResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RedisCacheAccessPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // RedisCacheAccessPolicyList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_RedisCacheAccessPolicyList() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyList.json + // this example is just showing the usage of "AccessPolicy_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisResource created on azure + // for more information of creating RedisResource, please refer to the document of RedisResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); + RedisResource redis = client.GetRedisResource(redisResourceId); + + // get the collection of this RedisCacheAccessPolicyResource + RedisCacheAccessPolicyCollection collection = redis.GetRedisCacheAccessPolicies(); + + // invoke the operation and iterate over the result + await foreach (RedisCacheAccessPolicyResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RedisCacheAccessPolicyData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyResource.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyResource.cs new file mode 100644 index 0000000000000..f3bd45bdd5d53 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCacheAccessPolicyResource.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Redis; + +namespace Azure.ResourceManager.Redis.Samples +{ + public partial class Sample_RedisCacheAccessPolicyResource + { + // RedisCacheAccessPolicyCreateUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_RedisCacheAccessPolicyCreateUpdate() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyCreateUpdate.json + // this example is just showing the usage of "AccessPolicy_CreateUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisCacheAccessPolicyResource created on azure + // for more information of creating RedisCacheAccessPolicyResource, please refer to the document of RedisCacheAccessPolicyResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + string accessPolicyName = "accessPolicy1"; + ResourceIdentifier redisCacheAccessPolicyResourceId = RedisCacheAccessPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName, accessPolicyName); + RedisCacheAccessPolicyResource redisCacheAccessPolicy = client.GetRedisCacheAccessPolicyResource(redisCacheAccessPolicyResourceId); + + // invoke the operation + RedisCacheAccessPolicyData data = new RedisCacheAccessPolicyData() + { + Permissions = "+get +hget", + }; + ArmOperation lro = await redisCacheAccessPolicy.UpdateAsync(WaitUntil.Completed, data); + RedisCacheAccessPolicyResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RedisCacheAccessPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // RedisCacheAccessPolicyDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_RedisCacheAccessPolicyDelete() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyDelete.json + // this example is just showing the usage of "AccessPolicy_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisCacheAccessPolicyResource created on azure + // for more information of creating RedisCacheAccessPolicyResource, please refer to the document of RedisCacheAccessPolicyResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + string accessPolicyName = "accessPolicy1"; + ResourceIdentifier redisCacheAccessPolicyResourceId = RedisCacheAccessPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName, accessPolicyName); + RedisCacheAccessPolicyResource redisCacheAccessPolicy = client.GetRedisCacheAccessPolicyResource(redisCacheAccessPolicyResourceId); + + // invoke the operation + await redisCacheAccessPolicy.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // RedisCacheAccessPolicyGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_RedisCacheAccessPolicyGet() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAccessPolicyGet.json + // this example is just showing the usage of "AccessPolicy_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisCacheAccessPolicyResource created on azure + // for more information of creating RedisCacheAccessPolicyResource, please refer to the document of RedisCacheAccessPolicyResource + string subscriptionId = "subid"; + string resourceGroupName = "rg1"; + string cacheName = "cache1"; + string accessPolicyName = "accessPolicy1"; + ResourceIdentifier redisCacheAccessPolicyResourceId = RedisCacheAccessPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName, accessPolicyName); + RedisCacheAccessPolicyResource redisCacheAccessPolicy = client.GetRedisCacheAccessPolicyResource(redisCacheAccessPolicyResourceId); + + // invoke the operation + RedisCacheAccessPolicyResource result = await redisCacheAccessPolicy.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RedisCacheAccessPolicyData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCollection.cs index 72ed416e5c8fa..ee47e769f12b6 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisCollection.cs @@ -25,7 +25,7 @@ public partial class Sample_RedisCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_RedisCacheCreate() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCreate.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreate.json // this example is just showing the usage of "Redis_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +78,7 @@ public async Task CreateOrUpdate_RedisCacheCreate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_RedisCacheCreateDefaultVersion() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCreateDefaultVersion.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreateDefaultVersion.json // this example is just showing the usage of "Redis_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -130,7 +130,7 @@ public async Task CreateOrUpdate_RedisCacheCreateDefaultVersion() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_RedisCacheCreateLatestVersion() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCreateLatestVersion.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCreateLatestVersion.json // this example is just showing the usage of "Redis_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -183,7 +183,7 @@ public async Task CreateOrUpdate_RedisCacheCreateLatestVersion() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_RedisCacheGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGet.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGet.json // this example is just showing the usage of "Redis_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 @@ -217,7 +217,7 @@ public async Task Get_RedisCacheGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_RedisCacheGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGet.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGet.json // this example is just showing the usage of "Redis_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 @@ -247,7 +247,7 @@ public async Task Exists_RedisCacheGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_RedisCacheGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGet.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGet.json // this example is just showing the usage of "Redis_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 @@ -289,7 +289,7 @@ public async Task GetIfExists_RedisCacheGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_RedisCacheListByResourceGroup() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListByResourceGroup.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListByResourceGroup.json // this example is just showing the usage of "Redis_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisFirewallRuleCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisFirewallRuleCollection.cs index 872a62c385d38..610cd832a02b5 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisFirewallRuleCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisFirewallRuleCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_RedisFirewallRuleCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_RedisCacheFirewallRulesList() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRulesList.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRulesList.json // this example is just showing the usage of "FirewallRules_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 @@ -60,7 +60,7 @@ public async Task GetAll_RedisCacheFirewallRulesList() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_RedisCacheFirewallRuleCreate() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleCreate.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleCreate.json // this example is just showing the usage of "FirewallRules_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -97,7 +97,7 @@ public async Task CreateOrUpdate_RedisCacheFirewallRuleCreate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_RedisCacheFirewallRuleGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleGet.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleGet.json // this example is just showing the usage of "FirewallRules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -132,7 +132,7 @@ public async Task Get_RedisCacheFirewallRuleGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_RedisCacheFirewallRuleGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleGet.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleGet.json // this example is just showing the usage of "FirewallRules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -163,7 +163,7 @@ public async Task Exists_RedisCacheFirewallRuleGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_RedisCacheFirewallRuleGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleGet.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleGet.json // this example is just showing the usage of "FirewallRules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisFirewallRuleResource.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisFirewallRuleResource.cs index 845e3766ed795..77ff57af9cdb2 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisFirewallRuleResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisFirewallRuleResource.cs @@ -23,7 +23,7 @@ public partial class Sample_RedisFirewallRuleResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_RedisCacheFirewallRuleCreate() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleCreate.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleCreate.json // this example is just showing the usage of "FirewallRules_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -57,7 +57,7 @@ public async Task Update_RedisCacheFirewallRuleCreate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_RedisCacheFirewallRuleGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleGet.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleGet.json // this example is just showing the usage of "FirewallRules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -89,7 +89,7 @@ public async Task Get_RedisCacheFirewallRuleGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_RedisCacheFirewallRuleDelete() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheFirewallRuleDelete.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFirewallRuleDelete.json // this example is just showing the usage of "FirewallRules_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs index eb07929033c45..01dd93debbd71 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_RedisLinkedServerWithPropertyCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_LinkedServerCreate() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Create.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Create.json // this example is just showing the usage of "LinkedServer_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -60,7 +60,7 @@ public async Task CreateOrUpdate_LinkedServerCreate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_LinkedServerGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Get.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Get.json // this example is just showing the usage of "LinkedServer_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -95,7 +95,7 @@ public async Task Get_LinkedServerGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_LinkedServerGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Get.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Get.json // this example is just showing the usage of "LinkedServer_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -126,7 +126,7 @@ public async Task Exists_LinkedServerGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_LinkedServerGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Get.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Get.json // this example is just showing the usage of "LinkedServer_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -169,7 +169,7 @@ public async Task GetIfExists_LinkedServerGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_LinkedServerList() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_List.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_List.json // this example is just showing the usage of "LinkedServer_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisLinkedServerWithPropertyResource.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisLinkedServerWithPropertyResource.cs index f61cd883b7faa..ceebe26ad16cc 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisLinkedServerWithPropertyResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisLinkedServerWithPropertyResource.cs @@ -23,7 +23,7 @@ public partial class Sample_RedisLinkedServerWithPropertyResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_LinkedServerCreate() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Create.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Create.json // this example is just showing the usage of "LinkedServer_Create" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -57,7 +57,7 @@ public async Task Update_LinkedServerCreate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_LinkedServerDelete() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Delete.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Delete.json // this example is just showing the usage of "LinkedServer_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -85,7 +85,7 @@ public async Task Delete_LinkedServerDelete() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_LinkedServerGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheLinkedServer_Get.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheLinkedServer_Get.json // this example is just showing the usage of "LinkedServer_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPatchScheduleCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPatchScheduleCollection.cs index 1267d22c1caeb..a2a42ff393d2d 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPatchScheduleCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPatchScheduleCollection.cs @@ -24,7 +24,7 @@ public partial class Sample_RedisPatchScheduleCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_RedisCachePatchSchedulesList() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesList.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesList.json // this example is just showing the usage of "PatchSchedules_ListByRedisResource" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -61,7 +61,7 @@ public async Task GetAll_RedisCachePatchSchedulesList() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_RedisCachePatchSchedulesCreateOrUpdate() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesCreateOrUpdate.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesCreateOrUpdate.json // this example is just showing the usage of "PatchSchedules_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -104,7 +104,7 @@ public async Task CreateOrUpdate_RedisCachePatchSchedulesCreateOrUpdate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_RedisCachePatchSchedulesGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesGet.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesGet.json // this example is just showing the usage of "PatchSchedules_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 @@ -139,7 +139,7 @@ public async Task Get_RedisCachePatchSchedulesGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_RedisCachePatchSchedulesGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesGet.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesGet.json // this example is just showing the usage of "PatchSchedules_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 @@ -170,7 +170,7 @@ public async Task Exists_RedisCachePatchSchedulesGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_RedisCachePatchSchedulesGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesGet.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesGet.json // this example is just showing the usage of "PatchSchedules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPatchScheduleResource.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPatchScheduleResource.cs index da84c33dd2add..fbf0bf1773e16 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPatchScheduleResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPatchScheduleResource.cs @@ -24,7 +24,7 @@ public partial class Sample_RedisPatchScheduleResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_RedisCachePatchSchedulesCreateOrUpdate() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesCreateOrUpdate.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesCreateOrUpdate.json // this example is just showing the usage of "PatchSchedules_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -64,7 +64,7 @@ public async Task Update_RedisCachePatchSchedulesCreateOrUpdate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_RedisCachePatchSchedulesDelete() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesDelete.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesDelete.json // this example is just showing the usage of "PatchSchedules_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -92,7 +92,7 @@ public async Task Delete_RedisCachePatchSchedulesDelete() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_RedisCachePatchSchedulesGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePatchSchedulesGet.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePatchSchedulesGet.json // this example is just showing the usage of "PatchSchedules_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs index b516489965d00..2346bc9580d52 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs @@ -23,7 +23,7 @@ public partial class Sample_RedisPrivateEndpointConnectionCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_RedisCacheListPrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListPrivateEndpointConnections.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListPrivateEndpointConnections.json // this example is just showing the usage of "PrivateEndpointConnections_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 @@ -60,7 +60,7 @@ public async Task GetAll_RedisCacheListPrivateEndpointConnection() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_RedisCacheGetPrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGetPrivateEndpointConnection.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -95,7 +95,7 @@ public async Task Get_RedisCacheGetPrivateEndpointConnection() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_RedisCacheGetPrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGetPrivateEndpointConnection.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -126,7 +126,7 @@ public async Task Exists_RedisCacheGetPrivateEndpointConnection() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_RedisCacheGetPrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGetPrivateEndpointConnection.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -169,7 +169,7 @@ public async Task GetIfExists_RedisCacheGetPrivateEndpointConnection() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_RedisCachePutPrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePutPrivateEndpointConnection.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePutPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Put" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPrivateEndpointConnectionResource.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPrivateEndpointConnectionResource.cs index 42e40c82fc5cc..68422f53c41a9 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPrivateEndpointConnectionResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisPrivateEndpointConnectionResource.cs @@ -23,7 +23,7 @@ public partial class Sample_RedisPrivateEndpointConnectionResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_RedisCacheGetPrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGetPrivateEndpointConnection.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGetPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -55,7 +55,7 @@ public async Task Get_RedisCacheGetPrivateEndpointConnection() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_RedisCachePutPrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCachePutPrivateEndpointConnection.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCachePutPrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Put" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -96,7 +96,7 @@ public async Task Update_RedisCachePutPrivateEndpointConnection() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_RedisCacheDeletePrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheDeletePrivateEndpointConnection.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheDeletePrivateEndpointConnection.json // this example is just showing the usage of "PrivateEndpointConnections_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisResource.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisResource.cs index eef37c0448846..0a14faa91f040 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_RedisResource.cs @@ -11,6 +11,7 @@ using Azure.Core; using Azure.Identity; using Azure.ResourceManager; +using Azure.ResourceManager.Models; using Azure.ResourceManager.Redis; using Azure.ResourceManager.Redis.Models; using Azure.ResourceManager.Resources; @@ -24,7 +25,7 @@ public partial class Sample_RedisResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CheckRedisNameAvailability_RedisCacheCheckNameAvailability() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheCheckNameAvailability.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheCheckNameAvailability.json // this example is just showing the usage of "Redis_CheckNameAvailability" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +51,7 @@ public async Task CheckRedisNameAvailability_RedisCacheCheckNameAvailability() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetUpgradeNotifications_RedisCacheListUpgradeNotifications() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListUpgradeNotifications.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListUpgradeNotifications.json // this example is just showing the usage of "Redis_ListUpgradeNotifications" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -81,7 +82,7 @@ public async Task GetUpgradeNotifications_RedisCacheListUpgradeNotifications() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_RedisCacheUpdate() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheUpdate.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheUpdate.json // this example is just showing the usage of "Redis_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -118,7 +119,7 @@ public async Task Update_RedisCacheUpdate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_RedisCacheDelete() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheDelete.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheDelete.json // this example is just showing the usage of "Redis_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -145,7 +146,7 @@ public async Task Delete_RedisCacheDelete() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_RedisCacheGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheGet.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheGet.json // this example is just showing the usage of "Redis_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -176,7 +177,7 @@ public async Task Get_RedisCacheGet() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAllRedis_RedisCacheList() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheList.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheList.json // this example is just showing the usage of "Redis_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -208,7 +209,7 @@ public async Task GetAllRedis_RedisCacheList() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetKeys_RedisCacheListKeys() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListKeys.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListKeys.json // this example is just showing the usage of "Redis_ListKeys" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -235,7 +236,7 @@ public async Task GetKeys_RedisCacheListKeys() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task RegenerateKey_RedisCacheRegenerateKey() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheRegenerateKey.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheRegenerateKey.json // this example is just showing the usage of "Redis_RegenerateKey" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -263,7 +264,7 @@ public async Task RegenerateKey_RedisCacheRegenerateKey() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ForceReboot_RedisCacheForceReboot() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheForceReboot.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheForceReboot.json // this example is just showing the usage of "Redis_ForceReboot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -299,7 +300,7 @@ public async Task ForceReboot_RedisCacheForceReboot() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ImportData_RedisCacheImport() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheImport.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheImport.json // this example is just showing the usage of "Redis_ImportData" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -334,7 +335,7 @@ public async Task ImportData_RedisCacheImport() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ExportData_RedisCacheExport() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheExport.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheExport.json // this example is just showing the usage of "Redis_ExportData" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -361,12 +362,40 @@ public async Task ExportData_RedisCacheExport() Console.WriteLine($"Succeeded"); } + // RedisCacheFlush + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task FlushCache_RedisCacheFlush() + { + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheFlush.json + // this example is just showing the usage of "Redis_FlushCache" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RedisResource created on azure + // for more information of creating RedisResource, please refer to the document of RedisResource + string subscriptionId = "subcription-id"; + string resourceGroupName = "resource-group-name"; + string cacheName = "cache-name"; + ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); + RedisResource redis = client.GetRedisResource(redisResourceId); + + // invoke the operation + ArmOperation lro = await redis.FlushCacheAsync(WaitUntil.Completed); + OperationStatusResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + // StorageAccountListPrivateLinkResources [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetPrivateLinkResourcesByRedisCache_StorageAccountListPrivateLinkResources() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheListPrivateLinkResources.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheListPrivateLinkResources.json // this example is just showing the usage of "PrivateLinkResources_ListByRedisCache" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index dcfa630a5b76a..4920f56c6df77 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -23,7 +23,7 @@ public partial class Sample_SubscriptionResourceExtensions [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAsyncOperationStatus_RedisCacheAsyncOperationStatus() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-04-01/examples/RedisCacheAsyncOperationStatus.json + // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2023-08-01/examples/RedisCacheAsyncOperationStatus.json // this example is just showing the usage of "AsyncOperationStatus_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Customization/ArmRedisModelFactory.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Customization/ArmRedisModelFactory.cs new file mode 100644 index 0000000000000..ca5c85c8dc651 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Customization/ArmRedisModelFactory.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using System.Net; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Redis; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Redis.Models +{ + /// Model factory for models. + public static partial class ArmRedisModelFactory + { + /// Initializes a new instance of RedisCommonConfiguration. + /// Specifies whether the rdb backup is enabled. + /// Specifies the frequency for creating rdb backup in minutes. Valid values: (15, 30, 60, 360, 720, 1440). + /// Specifies the maximum number of snapshots for rdb backup. + /// The storage account connection string for storing rdb file. + /// Specifies whether the aof backup is enabled. + /// First storage account connection string. + /// Second storage account connection string. + /// Value in megabytes reserved for fragmentation per shard. + /// The eviction strategy used when your data won't fit within its memory limit. + /// Value in megabytes reserved for non-cache usage per shard e.g. failover. + /// Value in megabytes reserved for non-cache usage per shard e.g. failover. + /// The max clients config. + /// Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. + /// Preferred auth method to communicate to storage account used for data persistence, specify SAS or ManagedIdentity, default value is SAS. + /// Zonal Configuration. + /// Specifies whether the authentication is disabled. Setting this property is highly discouraged from security point of view. + /// SubscriptionId of the storage account for persistence (aof/rdb) using ManagedIdentity. + /// Additional Properties. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static RedisCommonConfiguration RedisCommonConfiguration(bool? isRdbBackupEnabled = null, string rdbBackupFrequency = null, int? rdbBackupMaxSnapshotCount = null, string rdbStorageConnectionString = null, bool? isAofBackupEnabled = null, string aofStorageConnectionString0 = null, string aofStorageConnectionString1 = null, string maxFragmentationMemoryReserved = null, string maxMemoryPolicy = null, string maxMemoryReserved = null, string maxMemoryDelta = null, string maxClients = null, string preferredDataArchiveAuthMethod = null, string preferredDataPersistenceAuthMethod = null, string zonalConfiguration = null, string authNotRequired = null, string storageSubscriptionId = null, IDictionary additionalProperties = null) + { + additionalProperties ??= new Dictionary(); + + return new RedisCommonConfiguration(isRdbBackupEnabled, rdbBackupFrequency, rdbBackupMaxSnapshotCount, rdbStorageConnectionString, isAofBackupEnabled, aofStorageConnectionString0, aofStorageConnectionString1, maxFragmentationMemoryReserved, maxMemoryPolicy, maxMemoryReserved, maxMemoryDelta, maxClients, preferredDataArchiveAuthMethod, preferredDataPersistenceAuthMethod, zonalConfiguration, authNotRequired, storageSubscriptionId, default, additionalProperties); + } + + /// Initializes a new instance of RedisData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// A list of availability zones denoting where the resource needs to come from. + /// The identity of the resource. + /// All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta,maxmemory-policy,notify-keyspace-events,maxmemory-samples,slowlog-log-slower-than,slowlog-max-len,list-max-ziplist-entries,list-max-ziplist-value,hash-max-ziplist-entries,hash-max-ziplist-value,set-max-intset-entries,zset-max-ziplist-entries,zset-max-ziplist-value etc. + /// Redis version. This should be in the form 'major[.minor]' (only 'major' is required) or the value 'latest' which refers to the latest stable Redis version that is available. Supported versions: 4.0, 6.0 (latest). Default value is 'latest'. + /// Specifies whether the non-ssl Redis server port (6379) is enabled. + /// The number of replicas to be created per primary. + /// The number of replicas to be created per primary. + /// A dictionary of tenant settings. + /// The number of shards to be created on a Premium Cluster Cache. + /// Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). + /// Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + /// The SKU of the Redis cache to deploy. + /// The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. + /// Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. + /// Redis instance provisioning status. + /// Redis host name. + /// Redis non-SSL port. + /// Redis SSL port. + /// The keys of the Redis cache - not set if this object is not the response to Create or Update redis cache. + /// List of the linked servers associated with the cache. + /// List of the Redis instances associated with the cache. + /// List of private endpoint connection associated with the specified redis cache. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static RedisData RedisData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, IEnumerable zones = null, ManagedServiceIdentity identity = null, RedisCommonConfiguration redisConfiguration = null, string redisVersion = null, bool? enableNonSslPort = null, int? replicasPerMaster = null, int? replicasPerPrimary = null, IDictionary tenantSettings = null, int? shardCount = null, RedisTlsVersion? minimumTlsVersion = null, RedisPublicNetworkAccess? publicNetworkAccess = null, RedisSku sku = null, ResourceIdentifier subnetId = null, IPAddress staticIP = null, RedisProvisioningState? provisioningState = null, string hostName = null, int? port = null, int? sslPort = null, RedisAccessKeys accessKeys = null, IEnumerable linkedServers = null, IEnumerable instances = null, IEnumerable privateEndpointConnections = null) + { + tags ??= new Dictionary(); + zones ??= new List(); + tenantSettings ??= new Dictionary(); + linkedServers ??= new List(); + instances ??= new List(); + privateEndpointConnections ??= new List(); + + return new RedisData(id, name, resourceType, systemData, tags, location, zones?.ToList(), identity, redisConfiguration, redisVersion, enableNonSslPort, replicasPerMaster, replicasPerPrimary, tenantSettings, shardCount, minimumTlsVersion, publicNetworkAccess, default, sku, subnetId, staticIP, provisioningState, hostName, port, sslPort, accessKeys, linkedServers?.ToList(), instances?.ToList(), privateEndpointConnections?.ToList()); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisCommonConfiguration.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisCommonConfiguration.Serialization.cs index 991129b4feb24..299849affa0ac 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisCommonConfiguration.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisCommonConfiguration.Serialization.cs @@ -86,6 +86,11 @@ public partial class RedisCommonConfiguration : IUtf8JsonSerializable writer.WritePropertyName("storage-subscription-id"u8); writer.WriteStringValue(StorageSubscriptionId); } + if (Optional.IsDefined(IsAadEnabled)) + { + writer.WritePropertyName("aad-enabled"u8); + writer.WriteStringValue(IsAadEnabled); + } foreach (var item in AdditionalProperties) { writer.WritePropertyName(item.Key); @@ -121,6 +126,7 @@ internal static RedisCommonConfiguration DeserializeRedisCommonConfiguration(Jso Optional zonalConfiguration = default; Optional authnotrequired = default; Optional storageSubscriptionId = default; + Optional aadEnabled = default; IDictionary additionalProperties = default; Dictionary additionalPropertiesDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -234,10 +240,15 @@ internal static RedisCommonConfiguration DeserializeRedisCommonConfiguration(Jso storageSubscriptionId = property.Value.GetString(); continue; } + if (property.NameEquals("aad-enabled"u8)) + { + aadEnabled = property.Value.GetString(); + continue; + } additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } additionalProperties = additionalPropertiesDictionary; - return new RedisCommonConfiguration(Optional.ToNullable(rdbBackupEnabled), rdbBackupFrequency.Value, Optional.ToNullable(rdbBackupMaxSnapshotCount), rdbStorageConnectionString.Value, Optional.ToNullable(aofBackupEnabled), aofStorageConnectionString0.Value, aofStorageConnectionString1.Value, maxfragmentationmemoryReserved.Value, maxmemoryPolicy.Value, maxmemoryReserved.Value, maxmemoryDelta.Value, maxclients.Value, preferredDataArchiveAuthMethod.Value, preferredDataPersistenceAuthMethod.Value, zonalConfiguration.Value, authnotrequired.Value, storageSubscriptionId.Value, additionalProperties); + return new RedisCommonConfiguration(Optional.ToNullable(rdbBackupEnabled), rdbBackupFrequency.Value, Optional.ToNullable(rdbBackupMaxSnapshotCount), rdbStorageConnectionString.Value, Optional.ToNullable(aofBackupEnabled), aofStorageConnectionString0.Value, aofStorageConnectionString1.Value, maxfragmentationmemoryReserved.Value, maxmemoryPolicy.Value, maxmemoryReserved.Value, maxmemoryDelta.Value, maxclients.Value, preferredDataArchiveAuthMethod.Value, preferredDataPersistenceAuthMethod.Value, zonalConfiguration.Value, authnotrequired.Value, storageSubscriptionId.Value, aadEnabled.Value, additionalProperties); } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs index 1d11a78f73dce..7f463fa214fb2 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs @@ -50,13 +50,14 @@ public static RedisUpgradeNotification RedisUpgradeNotification(string name = nu /// Zonal Configuration. /// Specifies whether the authentication is disabled. Setting this property is highly discouraged from security point of view. /// SubscriptionId of the storage account for persistence (aof/rdb) using ManagedIdentity. + /// Specifies whether AAD based authentication has been enabled or disabled for the cache. /// Additional Properties. /// A new instance for mocking. - public static RedisCommonConfiguration RedisCommonConfiguration(bool? isRdbBackupEnabled = null, string rdbBackupFrequency = null, int? rdbBackupMaxSnapshotCount = null, string rdbStorageConnectionString = null, bool? isAofBackupEnabled = null, string aofStorageConnectionString0 = null, string aofStorageConnectionString1 = null, string maxFragmentationMemoryReserved = null, string maxMemoryPolicy = null, string maxMemoryReserved = null, string maxMemoryDelta = null, string maxClients = null, string preferredDataArchiveAuthMethod = null, string preferredDataPersistenceAuthMethod = null, string zonalConfiguration = null, string authNotRequired = null, string storageSubscriptionId = null, IDictionary additionalProperties = null) + public static RedisCommonConfiguration RedisCommonConfiguration(bool? isRdbBackupEnabled = null, string rdbBackupFrequency = null, int? rdbBackupMaxSnapshotCount = null, string rdbStorageConnectionString = null, bool? isAofBackupEnabled = null, string aofStorageConnectionString0 = null, string aofStorageConnectionString1 = null, string maxFragmentationMemoryReserved = null, string maxMemoryPolicy = null, string maxMemoryReserved = null, string maxMemoryDelta = null, string maxClients = null, string preferredDataArchiveAuthMethod = null, string preferredDataPersistenceAuthMethod = null, string zonalConfiguration = null, string authNotRequired = null, string storageSubscriptionId = null, string isAadEnabled = null, IDictionary additionalProperties = null) { additionalProperties ??= new Dictionary(); - return new RedisCommonConfiguration(isRdbBackupEnabled, rdbBackupFrequency, rdbBackupMaxSnapshotCount, rdbStorageConnectionString, isAofBackupEnabled, aofStorageConnectionString0, aofStorageConnectionString1, maxFragmentationMemoryReserved, maxMemoryPolicy, maxMemoryReserved, maxMemoryDelta, maxClients, preferredDataArchiveAuthMethod, preferredDataPersistenceAuthMethod, zonalConfiguration, authNotRequired, storageSubscriptionId, additionalProperties); + return new RedisCommonConfiguration(isRdbBackupEnabled, rdbBackupFrequency, rdbBackupMaxSnapshotCount, rdbStorageConnectionString, isAofBackupEnabled, aofStorageConnectionString0, aofStorageConnectionString1, maxFragmentationMemoryReserved, maxMemoryPolicy, maxMemoryReserved, maxMemoryDelta, maxClients, preferredDataArchiveAuthMethod, preferredDataPersistenceAuthMethod, zonalConfiguration, authNotRequired, storageSubscriptionId, isAadEnabled, additionalProperties); } /// Initializes a new instance of . @@ -77,6 +78,7 @@ public static RedisCommonConfiguration RedisCommonConfiguration(bool? isRdbBacku /// The number of shards to be created on a Premium Cluster Cache. /// Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). /// Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + /// Optional: Specifies the update channel for the monthly Redis updates your Redis Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of 'Stable' channel caches. Default value is 'Stable'. /// The SKU of the Redis cache to deploy. /// The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. /// Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. @@ -89,7 +91,7 @@ public static RedisCommonConfiguration RedisCommonConfiguration(bool? isRdbBacku /// List of the Redis instances associated with the cache. /// List of private endpoint connection associated with the specified redis cache. /// A new instance for mocking. - public static RedisData RedisData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, IEnumerable zones = null, ManagedServiceIdentity identity = null, RedisCommonConfiguration redisConfiguration = null, string redisVersion = null, bool? enableNonSslPort = null, int? replicasPerMaster = null, int? replicasPerPrimary = null, IDictionary tenantSettings = null, int? shardCount = null, RedisTlsVersion? minimumTlsVersion = null, RedisPublicNetworkAccess? publicNetworkAccess = null, RedisSku sku = null, ResourceIdentifier subnetId = null, IPAddress staticIP = null, RedisProvisioningState? provisioningState = null, string hostName = null, int? port = null, int? sslPort = null, RedisAccessKeys accessKeys = null, IEnumerable linkedServers = null, IEnumerable instances = null, IEnumerable privateEndpointConnections = null) + public static RedisData RedisData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, IEnumerable zones = null, ManagedServiceIdentity identity = null, RedisCommonConfiguration redisConfiguration = null, string redisVersion = null, bool? enableNonSslPort = null, int? replicasPerMaster = null, int? replicasPerPrimary = null, IDictionary tenantSettings = null, int? shardCount = null, RedisTlsVersion? minimumTlsVersion = null, RedisPublicNetworkAccess? publicNetworkAccess = null, UpdateChannel? updateChannel = null, RedisSku sku = null, ResourceIdentifier subnetId = null, IPAddress staticIP = null, RedisProvisioningState? provisioningState = null, string hostName = null, int? port = null, int? sslPort = null, RedisAccessKeys accessKeys = null, IEnumerable linkedServers = null, IEnumerable instances = null, IEnumerable privateEndpointConnections = null) { tags ??= new Dictionary(); zones ??= new List(); @@ -98,7 +100,7 @@ public static RedisData RedisData(ResourceIdentifier id = null, string name = nu instances ??= new List(); privateEndpointConnections ??= new List(); - return new RedisData(id, name, resourceType, systemData, tags, location, zones?.ToList(), identity, redisConfiguration, redisVersion, enableNonSslPort, replicasPerMaster, replicasPerPrimary, tenantSettings, shardCount, minimumTlsVersion, publicNetworkAccess, sku, subnetId, staticIP, provisioningState, hostName, port, sslPort, accessKeys, linkedServers?.ToList(), instances?.ToList(), privateEndpointConnections?.ToList()); + return new RedisData(id, name, resourceType, systemData, tags, location, zones?.ToList(), identity, redisConfiguration, redisVersion, enableNonSslPort, replicasPerMaster, replicasPerPrimary, tenantSettings, shardCount, minimumTlsVersion, publicNetworkAccess, updateChannel, sku, subnetId, staticIP, provisioningState, hostName, port, sslPort, accessKeys, linkedServers?.ToList(), instances?.ToList(), privateEndpointConnections?.ToList()); } /// Initializes a new instance of . @@ -225,5 +227,34 @@ public static RedisOperationStatus RedisOperationStatus(ResourceIdentifier id = return new RedisOperationStatus(id, name, status, percentComplete, startOn, endOn, operations?.ToList(), error, properties); } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Provisioning state of access policy. + /// Built-In or Custom access policy. + /// Permissions for the access policy. Learn how to configure permissions at https://aka.ms/redis/AADPreRequisites. + /// A new instance for mocking. + public static RedisCacheAccessPolicyData RedisCacheAccessPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AccessPolicyProvisioningState? provisioningState = null, AccessPolicyType? typePropertiesType = null, string permissions = null) + { + return new RedisCacheAccessPolicyData(id, name, resourceType, systemData, provisioningState, typePropertiesType, permissions); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Provisioning state of an access policy assignment set. + /// Object Id to assign access policy to. + /// User friendly name for object id. Also represents username for token based authentication. + /// The name of the access policy that is being assigned. + /// A new instance for mocking. + public static RedisCacheAccessPolicyAssignmentData RedisCacheAccessPolicyAssignmentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AccessPolicyAssignmentProvisioningState? provisioningState = null, Guid? objectId = null, string objectIdAlias = null, string accessPolicyName = null) + { + return new RedisCacheAccessPolicyAssignmentData(id, name, resourceType, systemData, provisioningState, objectId, objectIdAlias, accessPolicyName); + } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisArmClient.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisArmClient.cs index 8850bead909ff..00fcc36137f7a 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisArmClient.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisArmClient.cs @@ -95,5 +95,29 @@ public virtual RedisPrivateEndpointConnectionResource GetRedisPrivateEndpointCon RedisPrivateEndpointConnectionResource.ValidateResourceId(id); return new RedisPrivateEndpointConnectionResource(Client, id); } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RedisCacheAccessPolicyResource GetRedisCacheAccessPolicyResource(ResourceIdentifier id) + { + RedisCacheAccessPolicyResource.ValidateResourceId(id); + return new RedisCacheAccessPolicyResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RedisCacheAccessPolicyAssignmentResource GetRedisCacheAccessPolicyAssignmentResource(ResourceIdentifier id) + { + RedisCacheAccessPolicyAssignmentResource.ValidateResourceId(id); + return new RedisCacheAccessPolicyAssignmentResource(Client, id); + } } } 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 77208a1c23565..8732cce7b9835 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/RedisExtensions.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/RedisExtensions.cs @@ -130,6 +130,44 @@ public static RedisPrivateEndpointConnectionResource GetRedisPrivateEndpointConn return GetMockableRedisArmClient(client).GetRedisPrivateEndpointConnectionResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static RedisCacheAccessPolicyResource GetRedisCacheAccessPolicyResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableRedisArmClient(client).GetRedisCacheAccessPolicyResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static RedisCacheAccessPolicyAssignmentResource GetRedisCacheAccessPolicyAssignmentResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableRedisArmClient(client).GetRedisCacheAccessPolicyAssignmentResource(id); + } + /// /// Gets a collection of RedisResources in the ResourceGroupResource. /// diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/OperationStatusResultOperationSource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/OperationStatusResultOperationSource.cs new file mode 100644 index 0000000000000..529046ebb8ada --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/OperationStatusResultOperationSource.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Redis +{ + internal class OperationStatusResultOperationSource : IOperationSource + { + OperationStatusResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + return JsonSerializer.Deserialize(document.RootElement.GetRawText()); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + return JsonSerializer.Deserialize(document.RootElement.GetRawText()); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisCacheAccessPolicyAssignmentOperationSource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisCacheAccessPolicyAssignmentOperationSource.cs new file mode 100644 index 0000000000000..41d951aa25c7e --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisCacheAccessPolicyAssignmentOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Redis +{ + internal class RedisCacheAccessPolicyAssignmentOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal RedisCacheAccessPolicyAssignmentOperationSource(ArmClient client) + { + _client = client; + } + + RedisCacheAccessPolicyAssignmentResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = RedisCacheAccessPolicyAssignmentData.DeserializeRedisCacheAccessPolicyAssignmentData(document.RootElement); + return new RedisCacheAccessPolicyAssignmentResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = RedisCacheAccessPolicyAssignmentData.DeserializeRedisCacheAccessPolicyAssignmentData(document.RootElement); + return new RedisCacheAccessPolicyAssignmentResource(_client, data); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisCacheAccessPolicyOperationSource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisCacheAccessPolicyOperationSource.cs new file mode 100644 index 0000000000000..8521782d07993 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisCacheAccessPolicyOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Redis +{ + internal class RedisCacheAccessPolicyOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal RedisCacheAccessPolicyOperationSource(ArmClient client) + { + _client = client; + } + + RedisCacheAccessPolicyResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = RedisCacheAccessPolicyData.DeserializeRedisCacheAccessPolicyData(document.RootElement); + return new RedisCacheAccessPolicyResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = RedisCacheAccessPolicyData.DeserializeRedisCacheAccessPolicyData(document.RootElement); + return new RedisCacheAccessPolicyResource(_client, data); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyAssignmentProvisioningState.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyAssignmentProvisioningState.cs new file mode 100644 index 0000000000000..94f574bc743c7 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyAssignmentProvisioningState.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Redis.Models +{ + /// Provisioning state of an access policy assignment set. + public readonly partial struct AccessPolicyAssignmentProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AccessPolicyAssignmentProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UpdatingValue = "Updating"; + private const string SucceededValue = "Succeeded"; + private const string DeletingValue = "Deleting"; + private const string DeletedValue = "Deleted"; + private const string CanceledValue = "Canceled"; + private const string FailedValue = "Failed"; + + /// Updating. + public static AccessPolicyAssignmentProvisioningState Updating { get; } = new AccessPolicyAssignmentProvisioningState(UpdatingValue); + /// Succeeded. + public static AccessPolicyAssignmentProvisioningState Succeeded { get; } = new AccessPolicyAssignmentProvisioningState(SucceededValue); + /// Deleting. + public static AccessPolicyAssignmentProvisioningState Deleting { get; } = new AccessPolicyAssignmentProvisioningState(DeletingValue); + /// Deleted. + public static AccessPolicyAssignmentProvisioningState Deleted { get; } = new AccessPolicyAssignmentProvisioningState(DeletedValue); + /// Canceled. + public static AccessPolicyAssignmentProvisioningState Canceled { get; } = new AccessPolicyAssignmentProvisioningState(CanceledValue); + /// Failed. + public static AccessPolicyAssignmentProvisioningState Failed { get; } = new AccessPolicyAssignmentProvisioningState(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(AccessPolicyAssignmentProvisioningState left, AccessPolicyAssignmentProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AccessPolicyAssignmentProvisioningState left, AccessPolicyAssignmentProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AccessPolicyAssignmentProvisioningState(string value) => new AccessPolicyAssignmentProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AccessPolicyAssignmentProvisioningState other && Equals(other); + /// + public bool Equals(AccessPolicyAssignmentProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyProvisioningState.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyProvisioningState.cs new file mode 100644 index 0000000000000..e8d6c1a0516e0 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyProvisioningState.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Redis.Models +{ + /// Provisioning state of access policy. + public readonly partial struct AccessPolicyProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AccessPolicyProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UpdatingValue = "Updating"; + private const string SucceededValue = "Succeeded"; + private const string DeletingValue = "Deleting"; + private const string DeletedValue = "Deleted"; + private const string CanceledValue = "Canceled"; + private const string FailedValue = "Failed"; + + /// Updating. + public static AccessPolicyProvisioningState Updating { get; } = new AccessPolicyProvisioningState(UpdatingValue); + /// Succeeded. + public static AccessPolicyProvisioningState Succeeded { get; } = new AccessPolicyProvisioningState(SucceededValue); + /// Deleting. + public static AccessPolicyProvisioningState Deleting { get; } = new AccessPolicyProvisioningState(DeletingValue); + /// Deleted. + public static AccessPolicyProvisioningState Deleted { get; } = new AccessPolicyProvisioningState(DeletedValue); + /// Canceled. + public static AccessPolicyProvisioningState Canceled { get; } = new AccessPolicyProvisioningState(CanceledValue); + /// Failed. + public static AccessPolicyProvisioningState Failed { get; } = new AccessPolicyProvisioningState(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(AccessPolicyProvisioningState left, AccessPolicyProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AccessPolicyProvisioningState left, AccessPolicyProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AccessPolicyProvisioningState(string value) => new AccessPolicyProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AccessPolicyProvisioningState other && Equals(other); + /// + public bool Equals(AccessPolicyProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyType.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyType.cs new file mode 100644 index 0000000000000..71f627d787b55 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Redis.Models +{ + /// Built-In or Custom access policy. + public readonly partial struct AccessPolicyType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AccessPolicyType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CustomValue = "Custom"; + private const string BuiltInValue = "BuiltIn"; + + /// Custom. + public static AccessPolicyType Custom { get; } = new AccessPolicyType(CustomValue); + /// BuiltIn. + public static AccessPolicyType BuiltIn { get; } = new AccessPolicyType(BuiltInValue); + /// Determines if two values are the same. + public static bool operator ==(AccessPolicyType left, AccessPolicyType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AccessPolicyType left, AccessPolicyType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AccessPolicyType(string value) => new AccessPolicyType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AccessPolicyType other && Equals(other); + /// + public bool Equals(AccessPolicyType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentData.Serialization.cs new file mode 100644 index 0000000000000..843a467736cc7 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentData.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Redis.Models; + +namespace Azure.ResourceManager.Redis +{ + public partial class RedisCacheAccessPolicyAssignmentData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ObjectId)) + { + writer.WritePropertyName("objectId"u8); + writer.WriteStringValue(ObjectId.Value); + } + if (Optional.IsDefined(ObjectIdAlias)) + { + writer.WritePropertyName("objectIdAlias"u8); + writer.WriteStringValue(ObjectIdAlias); + } + if (Optional.IsDefined(AccessPolicyName)) + { + writer.WritePropertyName("accessPolicyName"u8); + writer.WriteStringValue(AccessPolicyName); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static RedisCacheAccessPolicyAssignmentData DeserializeRedisCacheAccessPolicyAssignmentData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional provisioningState = default; + Optional objectId = default; + Optional objectIdAlias = default; + Optional accessPolicyName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new AccessPolicyAssignmentProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("objectId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + objectId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("objectIdAlias"u8)) + { + objectIdAlias = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("accessPolicyName"u8)) + { + accessPolicyName = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new RedisCacheAccessPolicyAssignmentData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(objectId), objectIdAlias.Value, accessPolicyName.Value); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.Serialization.cs new file mode 100644 index 0000000000000..7823e2452ffb7 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Redis; + +namespace Azure.ResourceManager.Redis.Models +{ + internal partial class RedisCacheAccessPolicyAssignmentList + { + internal static RedisCacheAccessPolicyAssignmentList DeserializeRedisCacheAccessPolicyAssignmentList(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RedisCacheAccessPolicyAssignmentData.DeserializeRedisCacheAccessPolicyAssignmentData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new RedisCacheAccessPolicyAssignmentList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.cs new file mode 100644 index 0000000000000..db857c8e68a0e --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Redis; + +namespace Azure.ResourceManager.Redis.Models +{ + /// List of access policies assignments (with properties) of a Redis cache. + internal partial class RedisCacheAccessPolicyAssignmentList + { + /// Initializes a new instance of . + internal RedisCacheAccessPolicyAssignmentList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of access policies assignments (with properties) of a Redis cache. + /// Link for next set. + internal RedisCacheAccessPolicyAssignmentList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// List of access policies assignments (with properties) of a Redis cache. + public IReadOnlyList Value { get; } + /// Link for next set. + public string NextLink { get; } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyData.Serialization.cs new file mode 100644 index 0000000000000..46b723c27af52 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyData.Serialization.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Redis.Models; + +namespace Azure.ResourceManager.Redis +{ + public partial class RedisCacheAccessPolicyData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Permissions)) + { + writer.WritePropertyName("permissions"u8); + writer.WriteStringValue(Permissions); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static RedisCacheAccessPolicyData DeserializeRedisCacheAccessPolicyData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional provisioningState = default; + Optional type0 = default; + Optional permissions = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new AccessPolicyProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("type"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type0 = new AccessPolicyType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("permissions"u8)) + { + permissions = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new RedisCacheAccessPolicyData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(type0), permissions.Value); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.Serialization.cs new file mode 100644 index 0000000000000..6ab21b4cdc802 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Redis; + +namespace Azure.ResourceManager.Redis.Models +{ + internal partial class RedisCacheAccessPolicyList + { + internal static RedisCacheAccessPolicyList DeserializeRedisCacheAccessPolicyList(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RedisCacheAccessPolicyData.DeserializeRedisCacheAccessPolicyData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new RedisCacheAccessPolicyList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.cs new file mode 100644 index 0000000000000..f85ce7aa7c7bc --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Redis; + +namespace Azure.ResourceManager.Redis.Models +{ + /// List of access policies (with properties) of a Redis cache. + internal partial class RedisCacheAccessPolicyList + { + /// Initializes a new instance of . + internal RedisCacheAccessPolicyList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of access policies (with properties) of a Redis cache. + /// Link for next set. + internal RedisCacheAccessPolicyList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// List of access policies (with properties) of a Redis cache. + public IReadOnlyList Value { get; } + /// Link for next set. + public string NextLink { get; } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.cs index 03b950b9b95e7..8a416a3b6aaea 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.cs @@ -38,8 +38,9 @@ public RedisCommonConfiguration() /// Zonal Configuration. /// Specifies whether the authentication is disabled. Setting this property is highly discouraged from security point of view. /// SubscriptionId of the storage account for persistence (aof/rdb) using ManagedIdentity. + /// Specifies whether AAD based authentication has been enabled or disabled for the cache. /// Additional Properties. - internal RedisCommonConfiguration(bool? isRdbBackupEnabled, string rdbBackupFrequency, int? rdbBackupMaxSnapshotCount, string rdbStorageConnectionString, bool? isAofBackupEnabled, string aofStorageConnectionString0, string aofStorageConnectionString1, string maxFragmentationMemoryReserved, string maxMemoryPolicy, string maxMemoryReserved, string maxMemoryDelta, string maxClients, string preferredDataArchiveAuthMethod, string preferredDataPersistenceAuthMethod, string zonalConfiguration, string authNotRequired, string storageSubscriptionId, IDictionary additionalProperties) + internal RedisCommonConfiguration(bool? isRdbBackupEnabled, string rdbBackupFrequency, int? rdbBackupMaxSnapshotCount, string rdbStorageConnectionString, bool? isAofBackupEnabled, string aofStorageConnectionString0, string aofStorageConnectionString1, string maxFragmentationMemoryReserved, string maxMemoryPolicy, string maxMemoryReserved, string maxMemoryDelta, string maxClients, string preferredDataArchiveAuthMethod, string preferredDataPersistenceAuthMethod, string zonalConfiguration, string authNotRequired, string storageSubscriptionId, string isAadEnabled, IDictionary additionalProperties) { IsRdbBackupEnabled = isRdbBackupEnabled; RdbBackupFrequency = rdbBackupFrequency; @@ -58,6 +59,7 @@ internal RedisCommonConfiguration(bool? isRdbBackupEnabled, string rdbBackupFreq ZonalConfiguration = zonalConfiguration; AuthNotRequired = authNotRequired; StorageSubscriptionId = storageSubscriptionId; + IsAadEnabled = isAadEnabled; AdditionalProperties = additionalProperties; } @@ -95,6 +97,8 @@ internal RedisCommonConfiguration(bool? isRdbBackupEnabled, string rdbBackupFreq public string AuthNotRequired { get; set; } /// SubscriptionId of the storage account for persistence (aof/rdb) using ManagedIdentity. public string StorageSubscriptionId { get; set; } + /// Specifies whether AAD based authentication has been enabled or disabled for the cache. + public string IsAadEnabled { get; set; } /// /// Additional Properties /// diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.Serialization.cs index afed57cd5efbe..963f97e757715 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.Serialization.cs @@ -96,6 +96,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("publicNetworkAccess"u8); writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); } + if (Optional.IsDefined(UpdateChannel)) + { + writer.WritePropertyName("updateChannel"u8); + writer.WriteStringValue(UpdateChannel.Value.ToString()); + } writer.WritePropertyName("sku"u8); writer.WriteObjectValue(Sku); if (Optional.IsDefined(SubnetId)) diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.cs index 3931cd221b6ee..2515f376ad77e 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.cs @@ -45,10 +45,11 @@ public RedisCreateOrUpdateContent(AzureLocation location, RedisSku sku) /// The number of shards to be created on a Premium Cluster Cache. /// Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). /// Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + /// Optional: Specifies the update channel for the monthly Redis updates your Redis Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of 'Stable' channel caches. Default value is 'Stable'. /// The SKU of the Redis cache to deploy. /// The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. /// Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. - internal RedisCreateOrUpdateContent(IList zones, AzureLocation location, IDictionary tags, ManagedServiceIdentity identity, RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, IDictionary tenantSettings, int? shardCount, RedisTlsVersion? minimumTlsVersion, RedisPublicNetworkAccess? publicNetworkAccess, RedisSku sku, ResourceIdentifier subnetId, IPAddress staticIP) + internal RedisCreateOrUpdateContent(IList zones, AzureLocation location, IDictionary tags, ManagedServiceIdentity identity, RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, IDictionary tenantSettings, int? shardCount, RedisTlsVersion? minimumTlsVersion, RedisPublicNetworkAccess? publicNetworkAccess, UpdateChannel? updateChannel, RedisSku sku, ResourceIdentifier subnetId, IPAddress staticIP) { Zones = zones; Location = location; @@ -63,6 +64,7 @@ internal RedisCreateOrUpdateContent(IList zones, AzureLocation location, ShardCount = shardCount; MinimumTlsVersion = minimumTlsVersion; PublicNetworkAccess = publicNetworkAccess; + UpdateChannel = updateChannel; Sku = sku; SubnetId = subnetId; StaticIP = staticIP; @@ -94,6 +96,8 @@ internal RedisCreateOrUpdateContent(IList zones, AzureLocation location, public RedisTlsVersion? MinimumTlsVersion { get; set; } /// Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. public RedisPublicNetworkAccess? PublicNetworkAccess { get; set; } + /// Optional: Specifies the update channel for the monthly Redis updates your Redis Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of 'Stable' channel caches. Default value is 'Stable'. + public UpdateChannel? UpdateChannel { get; set; } /// The SKU of the Redis cache to deploy. public RedisSku Sku { get; } /// The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisData.Serialization.cs index 1d514547603da..34fe779414515 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisData.Serialization.cs @@ -101,6 +101,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("publicNetworkAccess"u8); writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); } + if (Optional.IsDefined(UpdateChannel)) + { + writer.WritePropertyName("updateChannel"u8); + writer.WriteStringValue(UpdateChannel.Value.ToString()); + } writer.WritePropertyName("sku"u8); writer.WriteObjectValue(Sku); if (Optional.IsDefined(SubnetId)) @@ -140,6 +145,7 @@ internal static RedisData DeserializeRedisData(JsonElement element) Optional shardCount = default; Optional minimumTlsVersion = default; Optional publicNetworkAccess = default; + Optional updateChannel = default; RedisSku sku = default; Optional subnetId = default; Optional staticIP = default; @@ -310,6 +316,15 @@ internal static RedisData DeserializeRedisData(JsonElement element) publicNetworkAccess = new RedisPublicNetworkAccess(property0.Value.GetString()); continue; } + if (property0.NameEquals("updateChannel"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updateChannel = new UpdateChannel(property0.Value.GetString()); + continue; + } if (property0.NameEquals("sku"u8)) { sku = RedisSku.DeserializeRedisSku(property0.Value); @@ -421,7 +436,7 @@ internal static RedisData DeserializeRedisData(JsonElement element) continue; } } - return new RedisData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(zones), identity, redisConfiguration.Value, redisVersion.Value, Optional.ToNullable(enableNonSslPort), Optional.ToNullable(replicasPerMaster), Optional.ToNullable(replicasPerPrimary), Optional.ToDictionary(tenantSettings), Optional.ToNullable(shardCount), Optional.ToNullable(minimumTlsVersion), Optional.ToNullable(publicNetworkAccess), sku, subnetId.Value, staticIP.Value, Optional.ToNullable(provisioningState), hostName.Value, Optional.ToNullable(port), Optional.ToNullable(sslPort), accessKeys.Value, Optional.ToList(linkedServers), Optional.ToList(instances), Optional.ToList(privateEndpointConnections)); + return new RedisData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToList(zones), identity, redisConfiguration.Value, redisVersion.Value, Optional.ToNullable(enableNonSslPort), Optional.ToNullable(replicasPerMaster), Optional.ToNullable(replicasPerPrimary), Optional.ToDictionary(tenantSettings), Optional.ToNullable(shardCount), Optional.ToNullable(minimumTlsVersion), Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(updateChannel), sku, subnetId.Value, staticIP.Value, Optional.ToNullable(provisioningState), hostName.Value, Optional.ToNullable(port), Optional.ToNullable(sslPort), accessKeys.Value, Optional.ToList(linkedServers), Optional.ToList(instances), Optional.ToList(privateEndpointConnections)); } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.Serialization.cs index b18a016b9771c..9b5540b597b25 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.Serialization.cs @@ -84,6 +84,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("publicNetworkAccess"u8); writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); } + if (Optional.IsDefined(UpdateChannel)) + { + writer.WritePropertyName("updateChannel"u8); + writer.WriteStringValue(UpdateChannel.Value.ToString()); + } if (Optional.IsDefined(Sku)) { writer.WritePropertyName("sku"u8); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.cs index 631a64d40e54c..654c85e90545f 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.cs @@ -33,8 +33,9 @@ public RedisPatch() /// The number of shards to be created on a Premium Cluster Cache. /// Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). /// Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + /// Optional: Specifies the update channel for the monthly Redis updates your Redis Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of 'Stable' channel caches. Default value is 'Stable'. /// The SKU of the Redis cache to deploy. - internal RedisPatch(IDictionary tags, ManagedServiceIdentity identity, RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, IDictionary tenantSettings, int? shardCount, RedisTlsVersion? minimumTlsVersion, RedisPublicNetworkAccess? publicNetworkAccess, RedisSku sku) + internal RedisPatch(IDictionary tags, ManagedServiceIdentity identity, RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, IDictionary tenantSettings, int? shardCount, RedisTlsVersion? minimumTlsVersion, RedisPublicNetworkAccess? publicNetworkAccess, UpdateChannel? updateChannel, RedisSku sku) { Tags = tags; Identity = identity; @@ -47,6 +48,7 @@ internal RedisPatch(IDictionary tags, ManagedServiceIdentity ide ShardCount = shardCount; MinimumTlsVersion = minimumTlsVersion; PublicNetworkAccess = publicNetworkAccess; + UpdateChannel = updateChannel; Sku = sku; } @@ -72,6 +74,8 @@ internal RedisPatch(IDictionary tags, ManagedServiceIdentity ide public RedisTlsVersion? MinimumTlsVersion { get; set; } /// Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. public RedisPublicNetworkAccess? PublicNetworkAccess { get; set; } + /// Optional: Specifies the update channel for the monthly Redis updates your Redis Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of 'Stable' channel caches. Default value is 'Stable'. + public UpdateChannel? UpdateChannel { get; set; } /// The SKU of the Redis cache to deploy. public RedisSku Sku { get; set; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisProvisioningState.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisProvisioningState.cs index cc76ea0e2030d..e2954430a81c6 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisProvisioningState.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisProvisioningState.cs @@ -34,6 +34,7 @@ public RedisProvisioningState(string value) private const string UnlinkingValue = "Unlinking"; private const string UnprovisioningValue = "Unprovisioning"; private const string UpdatingValue = "Updating"; + private const string ConfiguringAADValue = "ConfiguringAAD"; /// Creating. public static RedisProvisioningState Creating { get; } = new RedisProvisioningState(CreatingValue); @@ -59,6 +60,8 @@ public RedisProvisioningState(string value) public static RedisProvisioningState Unprovisioning { get; } = new RedisProvisioningState(UnprovisioningValue); /// Updating. public static RedisProvisioningState Updating { get; } = new RedisProvisioningState(UpdatingValue); + /// ConfiguringAAD. + public static RedisProvisioningState ConfiguringAAD { get; } = new RedisProvisioningState(ConfiguringAADValue); /// Determines if two values are the same. public static bool operator ==(RedisProvisioningState left, RedisProvisioningState right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpdateChannel.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpdateChannel.cs new file mode 100644 index 0000000000000..407ab39b6ce61 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpdateChannel.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Redis.Models +{ + /// Optional: Specifies the update channel for the monthly Redis updates your Redis Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of 'Stable' channel caches. Default value is 'Stable'. + public readonly partial struct UpdateChannel : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public UpdateChannel(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StableValue = "Stable"; + private const string PreviewValue = "Preview"; + + /// Stable. + public static UpdateChannel Stable { get; } = new UpdateChannel(StableValue); + /// Preview. + public static UpdateChannel Preview { get; } = new UpdateChannel(PreviewValue); + /// Determines if two values are the same. + public static bool operator ==(UpdateChannel left, UpdateChannel right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(UpdateChannel left, UpdateChannel right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator UpdateChannel(string value) => new UpdateChannel(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is UpdateChannel other && Equals(other); + /// + public bool Equals(UpdateChannel other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentCollection.cs new file mode 100644 index 0000000000000..cf6d4fe3f96ea --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Redis +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetRedisCacheAccessPolicyAssignments method from an instance of . + /// + public partial class RedisCacheAccessPolicyAssignmentCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics; + private readonly AccessPolicyAssignmentRestOperations _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient; + + /// Initializes a new instance of the class for mocking. + protected RedisCacheAccessPolicyAssignmentCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal RedisCacheAccessPolicyAssignmentCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", RedisCacheAccessPolicyAssignmentResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(RedisCacheAccessPolicyAssignmentResource.ResourceType, out string redisCacheAccessPolicyAssignmentAccessPolicyAssignmentApiVersion); + _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient = new AccessPolicyAssignmentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisCacheAccessPolicyAssignmentAccessPolicyAssignmentApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != RedisResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, RedisResource.ResourceType), nameof(id)); + } + + /// + /// Adds the access policy assignment to the specified users + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_CreateUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the 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 access policy assignment. + /// Parameters supplied to the Create Update Access Policy Assignment operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string accessPolicyAssignmentName, RedisCacheAccessPolicyAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.CreateUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, data, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyAssignmentOperationSource(Client), _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics, Pipeline, _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.CreateCreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds the access policy assignment to the specified users + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_CreateUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the 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 access policy assignment. + /// Parameters supplied to the Create Update Access Policy Assignment operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string accessPolicyAssignmentName, RedisCacheAccessPolicyAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.CreateUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, data, cancellationToken); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyAssignmentOperationSource(Client), _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics, Pipeline, _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.CreateCreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of assignments for an access policy of a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_Get + /// + /// + /// + /// The name of the access policy assignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string accessPolicyAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); + + using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.Get"); + scope.Start(); + try + { + var response = await _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RedisCacheAccessPolicyAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of assignments for an access policy of a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_Get + /// + /// + /// + /// The name of the access policy assignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string accessPolicyAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); + + using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.Get"); + scope.Start(); + try + { + var response = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RedisCacheAccessPolicyAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of access policy assignments associated with this redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments + /// + /// + /// Operation Id + /// AccessPolicyAssignment_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisCacheAccessPolicyAssignmentResource(Client, RedisCacheAccessPolicyAssignmentData.DeserializeRedisCacheAccessPolicyAssignmentData(e)), _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics, Pipeline, "RedisCacheAccessPolicyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of access policy assignments associated with this redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments + /// + /// + /// Operation Id + /// AccessPolicyAssignment_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisCacheAccessPolicyAssignmentResource(Client, RedisCacheAccessPolicyAssignmentData.DeserializeRedisCacheAccessPolicyAssignmentData(e)), _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics, Pipeline, "RedisCacheAccessPolicyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_Get + /// + /// + /// + /// The name of the access policy assignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string accessPolicyAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); + + using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.Exists"); + scope.Start(); + try + { + var response = await _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_Get + /// + /// + /// + /// The name of the access policy assignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string accessPolicyAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); + + using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.Exists"); + scope.Start(); + try + { + var response = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_Get + /// + /// + /// + /// The name of the access policy assignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string accessPolicyAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); + + using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisCacheAccessPolicyAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_Get + /// + /// + /// + /// The name of the access policy assignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accessPolicyAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); + + using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisCacheAccessPolicyAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs new file mode 100644 index 0000000000000..73074b8bc6735 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Redis.Models; + +namespace Azure.ResourceManager.Redis +{ + /// + /// A class representing the RedisCacheAccessPolicyAssignment data model. + /// Response to an operation on access policy assignment + /// + public partial class RedisCacheAccessPolicyAssignmentData : ResourceData + { + /// Initializes a new instance of . + public RedisCacheAccessPolicyAssignmentData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Provisioning state of an access policy assignment set. + /// Object Id to assign access policy to. + /// User friendly name for object id. Also represents username for token based authentication. + /// The name of the access policy that is being assigned. + internal RedisCacheAccessPolicyAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AccessPolicyAssignmentProvisioningState? provisioningState, Guid? objectId, string objectIdAlias, string accessPolicyName) : base(id, name, resourceType, systemData) + { + ProvisioningState = provisioningState; + ObjectId = objectId; + ObjectIdAlias = objectIdAlias; + AccessPolicyName = accessPolicyName; + } + + /// Provisioning state of an access policy assignment set. + public AccessPolicyAssignmentProvisioningState? ProvisioningState { get; } + /// Object Id to assign access policy to. + public Guid? ObjectId { get; set; } + /// User friendly name for object id. Also represents username for token based authentication. + public string ObjectIdAlias { get; set; } + /// The name of the access policy that is being assigned. + public string AccessPolicyName { get; set; } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentResource.cs new file mode 100644 index 0000000000000..93b92568c7f96 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentResource.cs @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Redis +{ + /// + /// A Class representing a RedisCacheAccessPolicyAssignment along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetRedisCacheAccessPolicyAssignmentResource method. + /// Otherwise you can get one from its parent resource using the GetRedisCacheAccessPolicyAssignment method. + /// + public partial class RedisCacheAccessPolicyAssignmentResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The cacheName. + /// The accessPolicyAssignmentName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics; + private readonly AccessPolicyAssignmentRestOperations _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient; + private readonly RedisCacheAccessPolicyAssignmentData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Cache/redis/accessPolicyAssignments"; + + /// Initializes a new instance of the class for mocking. + protected RedisCacheAccessPolicyAssignmentResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal RedisCacheAccessPolicyAssignmentResource(ArmClient client, RedisCacheAccessPolicyAssignmentData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal RedisCacheAccessPolicyAssignmentResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string redisCacheAccessPolicyAssignmentAccessPolicyAssignmentApiVersion); + _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient = new AccessPolicyAssignmentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisCacheAccessPolicyAssignmentAccessPolicyAssignmentApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual RedisCacheAccessPolicyAssignmentData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the list of assignments for an access policy of a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentResource.Get"); + scope.Start(); + try + { + var response = await _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RedisCacheAccessPolicyAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of assignments for an access policy of a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentResource.Get"); + scope.Start(); + try + { + var response = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RedisCacheAccessPolicyAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the access policy assignment from a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentResource.Delete"); + scope.Start(); + try + { + var response = await _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(_redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics, Pipeline, _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the access policy assignment from a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentResource.Delete"); + scope.Start(); + try + { + var response = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new RedisArmOperation(_redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics, Pipeline, _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds the access policy assignment to the specified users + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_CreateUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters supplied to the Create Update Access Policy Assignment operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, RedisCacheAccessPolicyAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentResource.Update"); + scope.Start(); + try + { + var response = await _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.CreateUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyAssignmentOperationSource(Client), _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics, Pipeline, _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.CreateCreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds the access policy assignment to the specified users + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_CreateUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters supplied to the Create Update Access Policy Assignment operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, RedisCacheAccessPolicyAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentResource.Update"); + scope.Start(); + try + { + var response = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.CreateUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyAssignmentOperationSource(Client), _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics, Pipeline, _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.CreateCreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyCollection.cs new file mode 100644 index 0000000000000..335b2bbce8ee4 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Redis +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetRedisCacheAccessPolicies method from an instance of . + /// + public partial class RedisCacheAccessPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _redisCacheAccessPolicyAccessPolicyClientDiagnostics; + private readonly AccessPolicyRestOperations _redisCacheAccessPolicyAccessPolicyRestClient; + + /// Initializes a new instance of the class for mocking. + protected RedisCacheAccessPolicyCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal RedisCacheAccessPolicyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _redisCacheAccessPolicyAccessPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", RedisCacheAccessPolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(RedisCacheAccessPolicyResource.ResourceType, out string redisCacheAccessPolicyAccessPolicyApiVersion); + _redisCacheAccessPolicyAccessPolicyRestClient = new AccessPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisCacheAccessPolicyAccessPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != RedisResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, RedisResource.ResourceType), nameof(id)); + } + + /// + /// Adds an access policy to the redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_CreateUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the 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 access policy that is being added to the Redis cache. + /// Parameters supplied to the Create Update Access Policy operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string accessPolicyName, RedisCacheAccessPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _redisCacheAccessPolicyAccessPolicyRestClient.CreateUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, data, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyOperationSource(Client), _redisCacheAccessPolicyAccessPolicyClientDiagnostics, Pipeline, _redisCacheAccessPolicyAccessPolicyRestClient.CreateCreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an access policy to the redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_CreateUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the 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 access policy that is being added to the Redis cache. + /// Parameters supplied to the Create Update Access Policy operation. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string accessPolicyName, RedisCacheAccessPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _redisCacheAccessPolicyAccessPolicyRestClient.CreateUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, data, cancellationToken); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyOperationSource(Client), _redisCacheAccessPolicyAccessPolicyClientDiagnostics, Pipeline, _redisCacheAccessPolicyAccessPolicyRestClient.CreateCreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the detailed information about an access policy of a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_Get + /// + /// + /// + /// The name of the access policy that is being added to the Redis cache. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string accessPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); + + using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.Get"); + scope.Start(); + try + { + var response = await _redisCacheAccessPolicyAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RedisCacheAccessPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the detailed information about an access policy of a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_Get + /// + /// + /// + /// The name of the access policy that is being added to the Redis cache. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string accessPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); + + using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.Get"); + scope.Start(); + try + { + var response = _redisCacheAccessPolicyAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RedisCacheAccessPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of access policies associated with this redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies + /// + /// + /// Operation Id + /// AccessPolicy_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisCacheAccessPolicyAccessPolicyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisCacheAccessPolicyAccessPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisCacheAccessPolicyResource(Client, RedisCacheAccessPolicyData.DeserializeRedisCacheAccessPolicyData(e)), _redisCacheAccessPolicyAccessPolicyClientDiagnostics, Pipeline, "RedisCacheAccessPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of access policies associated with this redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies + /// + /// + /// Operation Id + /// AccessPolicy_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisCacheAccessPolicyAccessPolicyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisCacheAccessPolicyAccessPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisCacheAccessPolicyResource(Client, RedisCacheAccessPolicyData.DeserializeRedisCacheAccessPolicyData(e)), _redisCacheAccessPolicyAccessPolicyClientDiagnostics, Pipeline, "RedisCacheAccessPolicyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_Get + /// + /// + /// + /// The name of the access policy that is being added to the Redis cache. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string accessPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); + + using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.Exists"); + scope.Start(); + try + { + var response = await _redisCacheAccessPolicyAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_Get + /// + /// + /// + /// The name of the access policy that is being added to the Redis cache. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string accessPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); + + using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.Exists"); + scope.Start(); + try + { + var response = _redisCacheAccessPolicyAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_Get + /// + /// + /// + /// The name of the access policy that is being added to the Redis cache. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string accessPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); + + using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _redisCacheAccessPolicyAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisCacheAccessPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_Get + /// + /// + /// + /// The name of the access policy that is being added to the Redis cache. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string accessPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); + + using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _redisCacheAccessPolicyAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new RedisCacheAccessPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.cs new file mode 100644 index 0000000000000..9a4ad7e28ee0d --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Redis.Models; + +namespace Azure.ResourceManager.Redis +{ + /// + /// A class representing the RedisCacheAccessPolicy data model. + /// Response to get/put access policy. + /// + public partial class RedisCacheAccessPolicyData : ResourceData + { + /// Initializes a new instance of . + public RedisCacheAccessPolicyData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Provisioning state of access policy. + /// Built-In or Custom access policy. + /// Permissions for the access policy. Learn how to configure permissions at https://aka.ms/redis/AADPreRequisites. + internal RedisCacheAccessPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AccessPolicyProvisioningState? provisioningState, AccessPolicyType? typePropertiesType, string permissions) : base(id, name, resourceType, systemData) + { + ProvisioningState = provisioningState; + TypePropertiesType = typePropertiesType; + Permissions = permissions; + } + + /// Provisioning state of access policy. + public AccessPolicyProvisioningState? ProvisioningState { get; } + /// Built-In or Custom access policy. + public AccessPolicyType? TypePropertiesType { get; } + /// Permissions for the access policy. Learn how to configure permissions at https://aka.ms/redis/AADPreRequisites. + public string Permissions { get; set; } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyResource.cs new file mode 100644 index 0000000000000..b2468bc1b6123 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyResource.cs @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Redis +{ + /// + /// A Class representing a RedisCacheAccessPolicy along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetRedisCacheAccessPolicyResource method. + /// Otherwise you can get one from its parent resource using the GetRedisCacheAccessPolicy method. + /// + public partial class RedisCacheAccessPolicyResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The cacheName. + /// The accessPolicyName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _redisCacheAccessPolicyAccessPolicyClientDiagnostics; + private readonly AccessPolicyRestOperations _redisCacheAccessPolicyAccessPolicyRestClient; + private readonly RedisCacheAccessPolicyData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Cache/redis/accessPolicies"; + + /// Initializes a new instance of the class for mocking. + protected RedisCacheAccessPolicyResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal RedisCacheAccessPolicyResource(ArmClient client, RedisCacheAccessPolicyData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal RedisCacheAccessPolicyResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _redisCacheAccessPolicyAccessPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string redisCacheAccessPolicyAccessPolicyApiVersion); + _redisCacheAccessPolicyAccessPolicyRestClient = new AccessPolicyRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisCacheAccessPolicyAccessPolicyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual RedisCacheAccessPolicyData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the detailed information about an access policy of a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyResource.Get"); + scope.Start(); + try + { + var response = await _redisCacheAccessPolicyAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RedisCacheAccessPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the detailed information about an access policy of a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyResource.Get"); + scope.Start(); + try + { + var response = _redisCacheAccessPolicyAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new RedisCacheAccessPolicyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the access policy from a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyResource.Delete"); + scope.Start(); + try + { + var response = await _redisCacheAccessPolicyAccessPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(_redisCacheAccessPolicyAccessPolicyClientDiagnostics, Pipeline, _redisCacheAccessPolicyAccessPolicyRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes the access policy from a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyResource.Delete"); + scope.Start(); + try + { + var response = _redisCacheAccessPolicyAccessPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new RedisArmOperation(_redisCacheAccessPolicyAccessPolicyClientDiagnostics, Pipeline, _redisCacheAccessPolicyAccessPolicyRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an access policy to the redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_CreateUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters supplied to the Create Update Access Policy operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, RedisCacheAccessPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyResource.Update"); + scope.Start(); + try + { + var response = await _redisCacheAccessPolicyAccessPolicyRestClient.CreateUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyOperationSource(Client), _redisCacheAccessPolicyAccessPolicyClientDiagnostics, Pipeline, _redisCacheAccessPolicyAccessPolicyRestClient.CreateCreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Adds an access policy to the redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_CreateUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters supplied to the Create Update Access Policy operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, RedisCacheAccessPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyResource.Update"); + scope.Start(); + try + { + var response = _redisCacheAccessPolicyAccessPolicyRestClient.CreateUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyOperationSource(Client), _redisCacheAccessPolicyAccessPolicyClientDiagnostics, Pipeline, _redisCacheAccessPolicyAccessPolicyRestClient.CreateCreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.cs index 7723768b1e725..6cd349b040396 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.cs @@ -55,6 +55,7 @@ public RedisData(AzureLocation location, RedisSku sku) : base(location) /// The number of shards to be created on a Premium Cluster Cache. /// Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). /// Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. + /// Optional: Specifies the update channel for the monthly Redis updates your Redis Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of 'Stable' channel caches. Default value is 'Stable'. /// The SKU of the Redis cache to deploy. /// The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. /// Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. @@ -66,7 +67,7 @@ public RedisData(AzureLocation location, RedisSku sku) : base(location) /// List of the linked servers associated with the cache. /// List of the Redis instances associated with the cache. /// List of private endpoint connection associated with the specified redis cache. - internal RedisData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList zones, ManagedServiceIdentity identity, RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, IDictionary tenantSettings, int? shardCount, RedisTlsVersion? minimumTlsVersion, RedisPublicNetworkAccess? publicNetworkAccess, RedisSku sku, ResourceIdentifier subnetId, IPAddress staticIP, RedisProvisioningState? provisioningState, string hostName, int? port, int? sslPort, RedisAccessKeys accessKeys, IReadOnlyList linkedServers, IReadOnlyList instances, IReadOnlyList privateEndpointConnections) : base(id, name, resourceType, systemData, tags, location) + internal RedisData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IList zones, ManagedServiceIdentity identity, RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, IDictionary tenantSettings, int? shardCount, RedisTlsVersion? minimumTlsVersion, RedisPublicNetworkAccess? publicNetworkAccess, UpdateChannel? updateChannel, RedisSku sku, ResourceIdentifier subnetId, IPAddress staticIP, RedisProvisioningState? provisioningState, string hostName, int? port, int? sslPort, RedisAccessKeys accessKeys, IReadOnlyList linkedServers, IReadOnlyList instances, IReadOnlyList privateEndpointConnections) : base(id, name, resourceType, systemData, tags, location) { Zones = zones; Identity = identity; @@ -79,6 +80,7 @@ internal RedisData(ResourceIdentifier id, string name, ResourceType resourceType ShardCount = shardCount; MinimumTlsVersion = minimumTlsVersion; PublicNetworkAccess = publicNetworkAccess; + UpdateChannel = updateChannel; Sku = sku; SubnetId = subnetId; StaticIP = staticIP; @@ -114,6 +116,8 @@ internal RedisData(ResourceIdentifier id, string name, ResourceType resourceType public RedisTlsVersion? MinimumTlsVersion { get; set; } /// Whether or not public endpoint access is allowed for this cache. Value is optional but if passed in, must be 'Enabled' or 'Disabled'. If 'Disabled', private endpoints are the exclusive access method. Default value is 'Enabled'. public RedisPublicNetworkAccess? PublicNetworkAccess { get; set; } + /// Optional: Specifies the update channel for the monthly Redis updates your Redis Cache will receive. Caches using 'Preview' update channel get latest Redis updates at least 4 weeks ahead of 'Stable' channel caches. Default value is 'Stable'. + public UpdateChannel? UpdateChannel { get; set; } /// The SKU of the Redis cache to deploy. public RedisSku Sku { get; set; } /// The full resource ID of a subnet in a virtual network to deploy the Redis cache in. Example format: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/Microsoft.{Network|ClassicNetwork}/VirtualNetworks/vnet1/subnets/subnet1. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs index fe0adf3109a9b..59b4f26aaaf0d 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs @@ -15,6 +15,7 @@ using Azure.Core; using Azure.Core.Pipeline; using Azure.ResourceManager; +using Azure.ResourceManager.Models; using Azure.ResourceManager.Redis.Models; using Azure.ResourceManager.Resources; @@ -305,6 +306,112 @@ public virtual Response GetRedisPrivateE return GetRedisPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); } + /// Gets a collection of RedisCacheAccessPolicyResources in the Redis. + /// An object representing collection of RedisCacheAccessPolicyResources and their operations over a RedisCacheAccessPolicyResource. + public virtual RedisCacheAccessPolicyCollection GetRedisCacheAccessPolicies() + { + return GetCachedClient(client => new RedisCacheAccessPolicyCollection(client, Id)); + } + + /// + /// Gets the detailed information about an access policy of a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_Get + /// + /// + /// + /// The name of the access policy that is being added to 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> GetRedisCacheAccessPolicyAsync(string accessPolicyName, CancellationToken cancellationToken = default) + { + return await GetRedisCacheAccessPolicies().GetAsync(accessPolicyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the detailed information about an access policy of a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicies/{accessPolicyName} + /// + /// + /// Operation Id + /// AccessPolicy_Get + /// + /// + /// + /// The name of the access policy that is being added to 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 GetRedisCacheAccessPolicy(string accessPolicyName, CancellationToken cancellationToken = default) + { + return GetRedisCacheAccessPolicies().Get(accessPolicyName, cancellationToken); + } + + /// Gets a collection of RedisCacheAccessPolicyAssignmentResources in the Redis. + /// An object representing collection of RedisCacheAccessPolicyAssignmentResources and their operations over a RedisCacheAccessPolicyAssignmentResource. + public virtual RedisCacheAccessPolicyAssignmentCollection GetRedisCacheAccessPolicyAssignments() + { + return GetCachedClient(client => new RedisCacheAccessPolicyAssignmentCollection(client, Id)); + } + + /// + /// Gets the list of assignments for an access policy of a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_Get + /// + /// + /// + /// The name of the access policy assignment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRedisCacheAccessPolicyAssignmentAsync(string accessPolicyAssignmentName, CancellationToken cancellationToken = default) + { + return await GetRedisCacheAccessPolicyAssignments().GetAsync(accessPolicyAssignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the list of assignments for an access policy of a redis cache + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/accessPolicyAssignments/{accessPolicyAssignmentName} + /// + /// + /// Operation Id + /// AccessPolicyAssignment_Get + /// + /// + /// + /// The name of the access policy assignment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRedisCacheAccessPolicyAssignment(string accessPolicyAssignmentName, CancellationToken cancellationToken = default) + { + return GetRedisCacheAccessPolicyAssignments().Get(accessPolicyAssignmentName, cancellationToken); + } + /// /// Gets a Redis cache (resource description). /// @@ -907,6 +1014,74 @@ public virtual ArmOperation ExportData(WaitUntil waitUntil, ExportRdbContent con } } + /// + /// Deletes all of the keys in a cache. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/flush + /// + /// + /// Operation Id + /// Redis_FlushCache + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the 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> FlushCacheAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _redisClientDiagnostics.CreateScope("RedisResource.FlushCache"); + scope.Start(); + try + { + var response = await _redisRestClient.FlushCacheAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new OperationStatusResultOperationSource(), _redisClientDiagnostics, Pipeline, _redisRestClient.CreateFlushCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes all of the keys in a cache. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{cacheName}/flush + /// + /// + /// Operation Id + /// Redis_FlushCache + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the 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 FlushCache(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _redisClientDiagnostics.CreateScope("RedisResource.FlushCache"); + scope.Start(); + try + { + var response = _redisRestClient.FlushCache(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new RedisArmOperation(new OperationStatusResultOperationSource(), _redisClientDiagnostics, Pipeline, _redisRestClient.CreateFlushCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Gets the private link resources that need to be created for a redis cache. /// diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AccessPolicyAssignmentRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AccessPolicyAssignmentRestOperations.cs new file mode 100644 index 0000000000000..e57c90444bc1a --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AccessPolicyAssignmentRestOperations.cs @@ -0,0 +1,445 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Redis.Models; + +namespace Azure.ResourceManager.Redis +{ + internal partial class AccessPolicyAssignmentRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AccessPolicyAssignmentRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public AccessPolicyAssignmentRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-08-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateCreateUpdateRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName, RedisCacheAccessPolicyAssignmentData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Cache/redis/", false); + uri.AppendPath(cacheName, true); + uri.AppendPath("/accessPolicyAssignments/", false); + uri.AppendPath(accessPolicyAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds the access policy assignment to the specified users. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The name of the access policy assignment. + /// Parameters supplied to the Create Update Access Policy Assignment operation. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateUpdateAsync(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName, RedisCacheAccessPolicyAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateUpdateRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds the access policy assignment to the specified users. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The name of the access policy assignment. + /// Parameters supplied to the Create Update Access Policy Assignment operation. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateUpdate(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName, RedisCacheAccessPolicyAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateUpdateRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Cache/redis/", false); + uri.AppendPath(cacheName, true); + uri.AppendPath("/accessPolicyAssignments/", false); + uri.AppendPath(accessPolicyAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the access policy assignment from a redis cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The name of the access policy assignment. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the access policy assignment from a redis cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The name of the access policy assignment. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Cache/redis/", false); + uri.AppendPath(cacheName, true); + uri.AppendPath("/accessPolicyAssignments/", false); + uri.AppendPath(accessPolicyAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of assignments for an access policy of a redis cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The name of the access policy assignment. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RedisCacheAccessPolicyAssignmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RedisCacheAccessPolicyAssignmentData.DeserializeRedisCacheAccessPolicyAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((RedisCacheAccessPolicyAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of assignments for an access policy of a redis cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The name of the access policy assignment. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RedisCacheAccessPolicyAssignmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RedisCacheAccessPolicyAssignmentData.DeserializeRedisCacheAccessPolicyAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((RedisCacheAccessPolicyAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string cacheName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Cache/redis/", false); + uri.AppendPath(cacheName, true); + uri.AppendPath("/accessPolicyAssignments", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of access policy assignments associated with this redis cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, cacheName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RedisCacheAccessPolicyAssignmentList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RedisCacheAccessPolicyAssignmentList.DeserializeRedisCacheAccessPolicyAssignmentList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of access policy assignments associated with this redis cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, cacheName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RedisCacheAccessPolicyAssignmentList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RedisCacheAccessPolicyAssignmentList.DeserializeRedisCacheAccessPolicyAssignmentList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string cacheName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of access policy assignments associated with this redis cache. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, cacheName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RedisCacheAccessPolicyAssignmentList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RedisCacheAccessPolicyAssignmentList.DeserializeRedisCacheAccessPolicyAssignmentList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of access policy assignments associated with this redis cache. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, cacheName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RedisCacheAccessPolicyAssignmentList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RedisCacheAccessPolicyAssignmentList.DeserializeRedisCacheAccessPolicyAssignmentList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AccessPolicyRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AccessPolicyRestOperations.cs new file mode 100644 index 0000000000000..0dfdb280e40db --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AccessPolicyRestOperations.cs @@ -0,0 +1,445 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Redis.Models; + +namespace Azure.ResourceManager.Redis +{ + internal partial class AccessPolicyRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AccessPolicyRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public AccessPolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-08-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateCreateUpdateRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName, RedisCacheAccessPolicyData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Cache/redis/", false); + uri.AppendPath(cacheName, true); + uri.AppendPath("/accessPolicies/", false); + uri.AppendPath(accessPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Adds an access policy to the redis cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The name of the access policy that is being added to the Redis cache. + /// Parameters supplied to the Create Update Access Policy operation. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateUpdateAsync(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName, RedisCacheAccessPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateUpdateRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Adds an access policy to the redis cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The name of the access policy that is being added to the Redis cache. + /// Parameters supplied to the Create Update Access Policy operation. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateUpdate(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName, RedisCacheAccessPolicyData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateUpdateRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Cache/redis/", false); + uri.AppendPath(cacheName, true); + uri.AppendPath("/accessPolicies/", false); + uri.AppendPath(accessPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes the access policy from a redis cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The name of the access policy that is being added to the Redis cache. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes the access policy from a redis cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The name of the access policy that is being added to the Redis cache. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Cache/redis/", false); + uri.AppendPath(cacheName, true); + uri.AppendPath("/accessPolicies/", false); + uri.AppendPath(accessPolicyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the detailed information about an access policy of a redis cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The name of the access policy that is being added to the Redis cache. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RedisCacheAccessPolicyData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RedisCacheAccessPolicyData.DeserializeRedisCacheAccessPolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((RedisCacheAccessPolicyData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the detailed information about an access policy of a redis cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The name of the access policy that is being added to the Redis cache. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RedisCacheAccessPolicyData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RedisCacheAccessPolicyData.DeserializeRedisCacheAccessPolicyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((RedisCacheAccessPolicyData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string cacheName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Cache/redis/", false); + uri.AppendPath(cacheName, true); + uri.AppendPath("/accessPolicies", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of access policies associated with this redis cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, cacheName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RedisCacheAccessPolicyList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RedisCacheAccessPolicyList.DeserializeRedisCacheAccessPolicyList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of access policies associated with this redis cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, cacheName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RedisCacheAccessPolicyList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RedisCacheAccessPolicyList.DeserializeRedisCacheAccessPolicyList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string cacheName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of access policies associated with this redis cache. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, cacheName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RedisCacheAccessPolicyList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RedisCacheAccessPolicyList.DeserializeRedisCacheAccessPolicyList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of access policies associated with this redis cache. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, cacheName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RedisCacheAccessPolicyList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RedisCacheAccessPolicyList.DeserializeRedisCacheAccessPolicyList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AsyncOperationStatusRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AsyncOperationStatusRestOperations.cs index 3cd8816c54ec2..4aacb4e709130 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AsyncOperationStatusRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AsyncOperationStatusRestOperations.cs @@ -33,7 +33,7 @@ public AsyncOperationStatusRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-08-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -58,7 +58,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, AzureLocation locat } /// For checking the ongoing status of an operation. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The location at which operation was triggered. /// The ID of asynchronous operation. /// The cancellation token to use. @@ -86,7 +86,7 @@ public async Task> GetAsync(string subscriptionId } /// For checking the ongoing status of an operation. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The location at which operation was triggered. /// The ID of asynchronous operation. /// The cancellation token to use. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/FirewallRulesRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/FirewallRulesRestOperations.cs index 94dda23c9bfd9..9d2d00d6ce3ea 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/FirewallRulesRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/FirewallRulesRestOperations.cs @@ -33,7 +33,7 @@ public FirewallRulesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-08-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Gets all firewall rules in the specified redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListAsync(string subscr } /// Gets all firewall rules in the specified redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , or is null. @@ -143,8 +143,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Create or update a redis cache firewall rule. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the firewall rule. /// Parameters supplied to the create or update redis firewall rule operation. @@ -177,8 +177,8 @@ public async Task> CreateOrUpdateAsync(string su } /// Create or update a redis cache firewall rule. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the firewall rule. /// Parameters supplied to the create or update redis firewall rule operation. @@ -233,8 +233,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets a single firewall rule in a specified redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the firewall rule. /// The cancellation token to use. @@ -266,8 +266,8 @@ public async Task> GetAsync(string subscriptionI } /// Gets a single firewall rule in a specified redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the firewall rule. /// The cancellation token to use. @@ -321,8 +321,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes a single firewall rule in a specified redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the firewall rule. /// The cancellation token to use. @@ -348,8 +348,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes a single firewall rule in a specified redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the firewall rule. /// The cancellation token to use. @@ -390,8 +390,8 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Gets all firewall rules in the specified redis cache. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , , or is null. @@ -421,8 +421,8 @@ public async Task> ListNextPageAsync(strin /// Gets all firewall rules in the specified redis cache. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , , or is null. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/LinkedServerRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/LinkedServerRestOperations.cs index dd88b3fdc4c02..b29a57f7cb21b 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/LinkedServerRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/LinkedServerRestOperations.cs @@ -33,7 +33,7 @@ public LinkedServerRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-08-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -64,8 +64,8 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } /// Adds a linked server to the Redis cache (requires Premium SKU). - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the linked server that is being added to the Redis cache. /// Parameters supplied to the Create Linked server operation. @@ -93,8 +93,8 @@ public async Task CreateAsync(string subscriptionId, string resourceGr } /// Adds a linked server to the Redis cache (requires Premium SKU). - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the linked server that is being added to the Redis cache. /// Parameters supplied to the Create Linked server operation. @@ -144,8 +144,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the linked server from a redis cache (requires Premium SKU). - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// The name of the linked server that is being added to the Redis cache. /// The cancellation token to use. @@ -171,8 +171,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the linked server from a redis cache (requires Premium SKU). - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// The name of the linked server that is being added to the Redis cache. /// The cancellation token to use. @@ -220,8 +220,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the detailed information about a linked server of a redis cache (requires Premium SKU). - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// The name of the linked server. /// The cancellation token to use. @@ -253,8 +253,8 @@ public async Task> GetAsync(string s } /// Gets the detailed information about a linked server of a redis cache (requires Premium SKU). - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// The name of the linked server. /// The cancellation token to use. @@ -307,8 +307,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Gets the list of linked servers associated with this redis cache (requires Premium SKU). - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// The cancellation token to use. /// , or is null. @@ -336,8 +336,8 @@ public async Task> ListAsync(strin } /// Gets the list of linked servers associated with this redis cache (requires Premium SKU). - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// The cancellation token to use. /// , or is null. @@ -380,8 +380,8 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Gets the list of linked servers associated with this redis cache (requires Premium SKU). /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// The cancellation token to use. /// , , or is null. @@ -411,8 +411,8 @@ public async Task> ListNextPageAsy /// Gets the list of linked servers associated with this redis cache (requires Premium SKU). /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// The cancellation token to use. /// , , or is null. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PatchSchedulesRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PatchSchedulesRestOperations.cs index c9cef5c0bde1d..0765dbe24ee7c 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PatchSchedulesRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PatchSchedulesRestOperations.cs @@ -33,7 +33,7 @@ public PatchSchedulesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-08-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByRedisResourceRequest(string subscriptionId, str } /// Gets all patch schedules in the specified redis cache (there is only one). - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListByRedisResourceAsy } /// Gets all patch schedules in the specified redis cache (there is only one). - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , or is null. @@ -143,8 +143,8 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Create or replace the patching schedule for Redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// Default string modeled as parameter for auto generation to work correctly. /// Parameters to set the patching schedule for Redis cache. @@ -176,8 +176,8 @@ public async Task> CreateOrUpdateAsync(string s } /// Create or replace the patching schedule for Redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// Default string modeled as parameter for auto generation to work correctly. /// Parameters to set the patching schedule for Redis cache. @@ -231,8 +231,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the patching schedule of a redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// Default string modeled as parameter for auto generation to work correctly. /// The cancellation token to use. @@ -257,8 +257,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the patching schedule of a redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// Default string modeled as parameter for auto generation to work correctly. /// The cancellation token to use. @@ -305,8 +305,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the patching schedule of a redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// Default string modeled as parameter for auto generation to work correctly. /// The cancellation token to use. @@ -337,8 +337,8 @@ public async Task> GetAsync(string subscription } /// Gets the patching schedule of a redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// Default string modeled as parameter for auto generation to work correctly. /// The cancellation token to use. @@ -384,8 +384,8 @@ internal HttpMessage CreateListByRedisResourceNextPageRequest(string nextLink, s /// Gets all patch schedules in the specified redis cache (there is only one). /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , , or is null. @@ -415,8 +415,8 @@ public async Task> ListByRedisResourceNex /// Gets all patch schedules in the specified redis cache (there is only one). /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , , or is null. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 7990c30405b72..71cec92b484e1 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -33,7 +33,7 @@ public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-08-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// List all the private endpoint connections associated with the redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListAsync( } /// List all the private endpoint connections associated with the redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , or is null. @@ -139,8 +139,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets the specified private endpoint connection associated with the redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. @@ -172,8 +172,8 @@ public async Task> GetAsync(string } /// Gets the specified private endpoint connection associated with the redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. @@ -231,8 +231,8 @@ internal HttpMessage CreatePutRequest(string subscriptionId, string resourceGrou } /// Update the state of specified private endpoint connection associated with the redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the private endpoint connection associated with the Azure resource. /// The private endpoint connection properties. @@ -260,8 +260,8 @@ public async Task PutAsync(string subscriptionId, string resourceGroup } /// Update the state of specified private endpoint connection associated with the redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the private endpoint connection associated with the Azure resource. /// The private endpoint connection properties. @@ -311,8 +311,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes the specified private endpoint connection associated with the redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. @@ -338,8 +338,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the specified private endpoint connection associated with the redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs index 49392f2843f39..93497f0522e80 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs @@ -33,7 +33,7 @@ public PrivateLinkResourcesRestOperations(HttpPipeline pipeline, string applicat { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-08-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,8 +59,8 @@ internal HttpMessage CreateListByRedisCacheRequest(string subscriptionId, string } /// Gets the private link resources that need to be created for a redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , or is null. @@ -88,8 +88,8 @@ public async Task> ListByRedisCache } /// Gets the private link resources that need to be created for a redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , or is null. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisRestOperations.cs index f506556b13193..1e5ad3ed70f15 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisRestOperations.cs @@ -33,7 +33,7 @@ public RedisRestOperations(HttpPipeline pipeline, string applicationId, Uri endp { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-04-01"; + _apiVersion = apiVersion ?? "2023-08-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -59,7 +59,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, R } /// Checks that the redis cache name is valid and is not already in use. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// Parameters supplied to the CheckNameAvailability Redis operation. The only supported resource type is 'Microsoft.Cache/redis'. /// The cancellation token to use. /// or is null. @@ -81,7 +81,7 @@ public async Task CheckNameAvailabilityAsync(string subscriptionId, Re } /// Checks that the redis cache name is valid and is not already in use. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// Parameters supplied to the CheckNameAvailability Redis operation. The only supported resource type is 'Microsoft.Cache/redis'. /// The cancellation token to use. /// or is null. @@ -125,8 +125,8 @@ internal HttpMessage CreateListUpgradeNotificationsRequest(string subscriptionId } /// Gets any upgrade notifications for a Redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// how many minutes in past to look for upgrade notifications. /// The cancellation token to use. @@ -155,8 +155,8 @@ public async Task> ListUpgradeNot } /// Gets any upgrade notifications for a Redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// how many minutes in past to look for upgrade notifications. /// The cancellation token to use. @@ -209,8 +209,8 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } /// Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// Parameters supplied to the Create Redis operation. /// The cancellation token to use. @@ -236,8 +236,8 @@ public async Task CreateAsync(string subscriptionId, string resourceGr } /// Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// Parameters supplied to the Create Redis operation. /// The cancellation token to use. @@ -287,8 +287,8 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Update an existing Redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// Parameters supplied to the Update Redis operation. /// The cancellation token to use. @@ -314,8 +314,8 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Update an existing Redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// Parameters supplied to the Update Redis operation. /// The cancellation token to use. @@ -361,8 +361,8 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG } /// Deletes a Redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , or is null. @@ -387,8 +387,8 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes a Redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , or is null. @@ -433,8 +433,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou } /// Gets a Redis cache (resource description). - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , or is null. @@ -464,8 +464,8 @@ public async Task> GetAsync(string subscriptionId, string re } /// Gets a Redis cache (resource description). - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , or is null. @@ -514,8 +514,8 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str } /// Lists all Redis caches in a resource group. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -541,8 +541,8 @@ public async Task> ListByResourceGroupAsync(string sub } /// Lists all Redis caches in a resource group. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// or is null. /// or is an empty string, and was expected to be non-empty. @@ -585,7 +585,7 @@ internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) } /// Gets all Redis caches in the specified subscription. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -610,7 +610,7 @@ public async Task> ListBySubscriptionAsync(string subs } /// Gets all Redis caches in the specified subscription. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -656,8 +656,8 @@ internal HttpMessage CreateListKeysRequest(string subscriptionId, string resourc } /// Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , or is null. @@ -685,8 +685,8 @@ public async Task> ListKeysAsync(string subscriptionId } /// Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. /// , or is null. @@ -739,8 +739,8 @@ internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string re } /// Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// Specifies which key to regenerate. /// The cancellation token to use. @@ -770,8 +770,8 @@ public async Task> RegenerateKeyAsync(string subscript } /// Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// Specifies which key to regenerate. /// The cancellation token to use. @@ -826,8 +826,8 @@ internal HttpMessage CreateForceRebootRequest(string subscriptionId, string reso } /// Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// Specifies which Redis node(s) to reboot. /// The cancellation token to use. @@ -857,8 +857,8 @@ public async Task> ForceRebootAsync(string subs } /// Reboot specified Redis node(s). This operation requires write permission to the cache resource. There can be potential data loss. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// Specifies which Redis node(s) to reboot. /// The cancellation token to use. @@ -913,8 +913,8 @@ internal HttpMessage CreateImportDataRequest(string subscriptionId, string resou } /// Import data into Redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// Parameters for Redis import operation. /// The cancellation token to use. @@ -941,8 +941,8 @@ public async Task ImportDataAsync(string subscriptionId, string resour } /// Import data into Redis cache. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// Parameters for Redis import operation. /// The cancellation token to use. @@ -994,8 +994,8 @@ internal HttpMessage CreateExportDataRequest(string subscriptionId, string resou } /// Export data from the redis cache to blobs in a container. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// Parameters for Redis export operation. /// The cancellation token to use. @@ -1022,8 +1022,8 @@ public async Task ExportDataAsync(string subscriptionId, string resour } /// Export data from the redis cache to blobs in a container. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// Parameters for Redis export operation. /// The cancellation token to use. @@ -1049,6 +1049,77 @@ public Response ExportData(string subscriptionId, string resourceGroupName, stri } } + internal HttpMessage CreateFlushCacheRequest(string subscriptionId, string resourceGroupName, string cacheName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Cache/redis/", false); + uri.AppendPath(cacheName, true); + uri.AppendPath("/flush", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes all of the keys in a cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task FlushCacheAsync(string subscriptionId, string resourceGroupName, string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using var message = CreateFlushCacheRequest(subscriptionId, resourceGroupName, cacheName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes all of the keys in a cache. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response FlushCache(string subscriptionId, string resourceGroupName, string cacheName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + + using var message = CreateFlushCacheRequest(subscriptionId, resourceGroupName, cacheName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateListUpgradeNotificationsNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string name, double history) { var message = _pipeline.CreateMessage(); @@ -1065,8 +1136,8 @@ internal HttpMessage CreateListUpgradeNotificationsNextPageRequest(string nextLi /// Gets any upgrade notifications for a Redis cache. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// how many minutes in past to look for upgrade notifications. /// The cancellation token to use. @@ -1097,8 +1168,8 @@ public async Task> ListUpgradeNot /// Gets any upgrade notifications for a Redis cache. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// how many minutes in past to look for upgrade notifications. /// The cancellation token to use. @@ -1143,8 +1214,8 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s /// Lists all Redis caches in a resource group. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. /// or is an empty string, and was expected to be non-empty. @@ -1172,8 +1243,8 @@ public async Task> ListByResourceGroupNextPageAsync(st /// Lists all Redis caches in a resource group. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. - /// The name of the resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. /// or is an empty string, and was expected to be non-empty. @@ -1215,7 +1286,7 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st /// Gets all Redis caches in the specified subscription. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -1242,7 +1313,7 @@ public async Task> ListBySubscriptionNextPageAsync(str /// Gets all Redis caches in the specified subscription. /// The URL to the next page of results. - /// Gets subscription credentials which uniquely identify the Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The ID of the target subscription. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/autorest.md b/sdk/redis/Azure.ResourceManager.Redis/src/autorest.md index 109faeda7a546..f29e41a641f92 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/autorest.md +++ b/sdk/redis/Azure.ResourceManager.Redis/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true csharp: true library-name: Redis namespace: Azure.ResourceManager.Redis -require: https://github.com/Azure/azure-rest-api-specs/blob/ae9d07fdb281804d4af18b48d4b895e09a0ca35c/specification/redis/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/dac9f85a47b0e4e759593f3a19968a732b911b47/specification/redis/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: @@ -17,6 +17,7 @@ sample-gen: skip-csproj: true modelerfour: flatten-payloads: false + lenient-model-deduplication: true rename-mapping: CheckNameAvailabilityParameters: RedisNameAvailabilityContent @@ -42,6 +43,8 @@ rename-mapping: RedisCommonPropertiesRedisConfiguration.aof-backup-enabled: IsAofBackupEnabled|boolean RedisCommonPropertiesRedisConfiguration.rdb-backup-max-snapshot-count: -|integer RedisForceRebootResponse: RedisForceRebootResult + RedisCacheAccessPolicyAssignment.properties.objectId: -|uuid + RedisCommonPropertiesRedisConfiguration.aad-enabled: IsAadEnabled prepend-rp-prefix: - OperationStatus diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/ScenarioTests/AadFunctionalTests.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/ScenarioTests/AadFunctionalTests.cs new file mode 100644 index 0000000000000..4ca15b8bb7804 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/tests/ScenarioTests/AadFunctionalTests.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Redis.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Redis.Tests.ScenarioTests +{ + public class AadFunctionalTests : RedisManagementTestBase + { + private ResourceGroupResource ResourceGroup { get; set; } + private RedisCollection Collection { get; set; } + public AadFunctionalTests(bool isAsync) + : base(isAsync)//, RecordedTestMode.Record) + { + } + + private async Task SetCollectionsAsync() + { + ResourceGroup = await CreateResourceGroupAsync(); + Collection = ResourceGroup.GetAllRedis(); + } + [Test] + public async Task AadTests() + { + // Create aad enabled cache + await SetCollectionsAsync(); + string redisCacheName = Recording.GenerateAssetName("AadTestCache"); + RedisCreateOrUpdateContent redisCreationParameters = new RedisCreateOrUpdateContent(DefaultLocation, new RedisSku(RedisSkuName.Premium, RedisSkuFamily.Premium, 1)) + { + RedisConfiguration = new RedisCommonConfiguration() + { + IsAadEnabled = "true" + } + }; + RedisResource redisResource = (await Collection.CreateOrUpdateAsync(WaitUntil.Completed, redisCacheName, redisCreationParameters)).Value; + + // Verify cache is aad enabled + Assert.IsTrue(string.Equals(redisResource.Data.RedisConfiguration.IsAadEnabled, "true", StringComparison.OrdinalIgnoreCase)); + + // List access polices + RedisCacheAccessPolicyCollection accessPolicyCollection = redisResource.GetRedisCacheAccessPolicies(); + var accessPolicyList = await accessPolicyCollection.GetAllAsync().ToEnumerableAsync(); + Assert.AreEqual(3, accessPolicyList.Count); + + // Create custom access policy + string accessPolicyName = "accessPolicy1"; + RedisCacheAccessPolicyData accessPolicyData = new RedisCacheAccessPolicyData() + { + Permissions = "+get +hget", + }; + var accessPolicy = (await accessPolicyCollection.CreateOrUpdateAsync(WaitUntil.Completed, accessPolicyName, accessPolicyData)).Value; + Assert.AreEqual("accessPolicy1", accessPolicy.Data.Name); + Assert.AreEqual("+get +hget allkeys", accessPolicy.Data.Permissions); + + // List access polices + accessPolicyList = await accessPolicyCollection.GetAllAsync().ToEnumerableAsync(); + Assert.AreEqual(4, accessPolicyList.Count); + + // Update access policy + accessPolicyData = new RedisCacheAccessPolicyData() + { + Permissions = "+get", + }; + accessPolicy = (await accessPolicyCollection.CreateOrUpdateAsync(WaitUntil.Completed, accessPolicyName, accessPolicyData)).Value; + Assert.AreEqual("accessPolicy1", accessPolicy.Data.Name); + Assert.AreEqual("+get allkeys", accessPolicy.Data.Permissions); + + // Get access policy + accessPolicy = await accessPolicyCollection.GetAsync(accessPolicyName); + Assert.AreEqual("accessPolicy1", accessPolicy.Data.Name); + Assert.AreEqual("+get allkeys", accessPolicy.Data.Permissions); + + // Create custom access policy assignment + RedisCacheAccessPolicyAssignmentCollection accessPolicyAssignmentCollection = redisResource.GetRedisCacheAccessPolicyAssignments(); + string accessPolicyAssignmentName = "accessPolicyAssignmentName1"; + RedisCacheAccessPolicyAssignmentData accessPolicyAssignmentData = new RedisCacheAccessPolicyAssignmentData() + { + ObjectId = new Guid("69d700c5-ca77-4335-947e-4f823dd00e1a"), + ObjectIdAlias = "kj-aad-testing", + AccessPolicyName = "accessPolicy1" + }; + var accessPolicyAssignment = (await accessPolicyAssignmentCollection.CreateOrUpdateAsync(WaitUntil.Completed, accessPolicyAssignmentName, accessPolicyAssignmentData)).Value; + Assert.AreEqual("accessPolicyAssignmentName1", accessPolicyAssignment.Data.Name); + Assert.AreEqual("accessPolicy1", accessPolicyAssignment.Data.AccessPolicyName); + Assert.AreEqual(new Guid("69d700c5-ca77-4335-947e-4f823dd00e1a"), accessPolicyAssignment.Data.ObjectId); + Assert.AreEqual("kj-aad-testing", accessPolicyAssignment.Data.ObjectIdAlias); + + // List access policy assignments + var accessPolicyAssignmentList = await accessPolicyAssignmentCollection.GetAllAsync().ToEnumerableAsync(); + Assert.AreEqual(1, accessPolicyAssignmentList.Count); + + // Update access policy assignment + accessPolicyAssignmentData = new RedisCacheAccessPolicyAssignmentData() + { + ObjectId = new Guid("69d700c5-ca77-4335-947e-4f823dd00e1a"), + ObjectIdAlias = "aad testing app", + AccessPolicyName = "accessPolicy1" + }; + accessPolicyAssignment = (await accessPolicyAssignmentCollection.CreateOrUpdateAsync(WaitUntil.Completed, accessPolicyAssignmentName, accessPolicyAssignmentData)).Value; + Assert.AreEqual("aad testing app", accessPolicyAssignment.Data.ObjectIdAlias); + + // Get access policy assignment + accessPolicyAssignment = await accessPolicyAssignmentCollection.GetAsync(accessPolicyAssignmentName); + Assert.AreEqual("accessPolicyAssignmentName1", accessPolicyAssignment.Data.Name); + Assert.AreEqual("accessPolicy1", accessPolicyAssignment.Data.AccessPolicyName); + Assert.AreEqual(new Guid("69d700c5-ca77-4335-947e-4f823dd00e1a"), accessPolicyAssignment.Data.ObjectId); + Assert.AreEqual("aad testing app", accessPolicyAssignment.Data.ObjectIdAlias); + + // Delete access policy assignment + await accessPolicyAssignment.DeleteAsync(WaitUntil.Completed); + var accessPolicyAssignmentExists = (await accessPolicyCollection.ExistsAsync(accessPolicyAssignmentName)).Value; + Assert.IsFalse(accessPolicyAssignmentExists); + + // List access policy assignments + accessPolicyAssignmentList = await accessPolicyAssignmentCollection.GetAllAsync().ToEnumerableAsync(); + Assert.AreEqual(0, accessPolicyAssignmentList.Count); + + // Delete access policy + await accessPolicy.DeleteAsync(WaitUntil.Completed); + var accessPolicyExists = (await accessPolicyCollection.ExistsAsync(accessPolicyName)).Value; + Assert.IsFalse(accessPolicyExists); + + // List access polices + accessPolicyList = await accessPolicyCollection.GetAllAsync().ToEnumerableAsync(); + Assert.AreEqual(3, accessPolicyList.Count); + + // Disable aad on cache + redisCreationParameters = new RedisCreateOrUpdateContent(DefaultLocation, new RedisSku(RedisSkuName.Premium, RedisSkuFamily.Premium, 1)) + { + RedisConfiguration = new RedisCommonConfiguration() + { + IsAadEnabled = "false" + } + }; + redisResource = (await Collection.CreateOrUpdateAsync(WaitUntil.Completed, redisCacheName, redisCreationParameters)).Value; + + // Verify cache is aad disabled + Assert.IsTrue(string.Equals(redisResource.Data.RedisConfiguration.IsAadEnabled, "false", StringComparison.OrdinalIgnoreCase)); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/ScenarioTests/FlushFunctionalTests.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/ScenarioTests/FlushFunctionalTests.cs new file mode 100644 index 0000000000000..704bf18236043 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/tests/ScenarioTests/FlushFunctionalTests.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading.Tasks; +using Azure.ResourceManager.Redis.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Redis.Tests.ScenarioTests +{ + public class FlushFunctionalTests : RedisManagementTestBase + { + private ResourceGroupResource ResourceGroup { get; set; } + private RedisCollection Collection { get; set; } + public FlushFunctionalTests(bool isAsync) + : base(isAsync) //, RecordedTestMode.Record) + { + } + + private async Task SetCollectionsAsync() + { + ResourceGroup = await CreateResourceGroupAsync(); + Collection = ResourceGroup.GetAllRedis(); + } + [Test] + public async Task FlushInvocationTest() + { + // Create cache + await SetCollectionsAsync(); + string redisCacheName = Recording.GenerateAssetName("RedisFlush"); + RedisCreateOrUpdateContent redisCreationParameters = new RedisCreateOrUpdateContent(DefaultLocation, new RedisSku(RedisSkuName.Standard, RedisSkuFamily.BasicOrStandard, 1)); + RedisResource redisResource = (await Collection.CreateOrUpdateAsync(WaitUntil.Completed, redisCacheName, redisCreationParameters)).Value; + // Execute flush + await redisResource.FlushCacheAsync(WaitUntil.Completed); + } + [Test] + public async Task FlushValidationFailureTest() + { + // Create cache + await SetCollectionsAsync(); + string redisCacheName = Recording.GenerateAssetName("RedisFlush"); + RedisCreateOrUpdateContent redisCreationParameters = new RedisCreateOrUpdateContent(DefaultLocation, new RedisSku(RedisSkuName.Standard, RedisSkuFamily.BasicOrStandard, 1)); + RedisResource redisResource = (await Collection.CreateOrUpdateAsync(WaitUntil.Completed, redisCacheName, redisCreationParameters)).Value; + + // Scale cache so that it doesn't except flush requests + RedisPatch redisPatch = new RedisPatch() + { + Sku = new RedisSku(RedisSkuName.Standard, RedisSkuFamily.BasicOrStandard, 2) + }; + await redisResource.UpdateAsync(WaitUntil.Started, redisPatch); + + // Validate the flush request throws exception + Assert.ThrowsAsync(() => redisResource.FlushCacheAsync(WaitUntil.Completed)); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/ScenarioTests/UpdateChannelFunctionalTests.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/ScenarioTests/UpdateChannelFunctionalTests.cs new file mode 100644 index 0000000000000..92a6ae46568f7 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/tests/ScenarioTests/UpdateChannelFunctionalTests.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading.Tasks; +using Azure.ResourceManager.Redis.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Redis.Tests +{ + public class UpdateChannelFunctionalTests : RedisManagementTestBase + { + public UpdateChannelFunctionalTests(bool isAsync) + : base(isAsync) // RecordedTestMode.Record) + { + } + + private ResourceGroupResource ResourceGroup { get; set; } + + private RedisCollection Collection { get; set; } + + private async Task SetCollectionsAsync() + { + ResourceGroup = await CreateResourceGroupAsync(); + Collection = ResourceGroup.GetAllRedis(); + } + + [Test] + public async Task UpdateChannelDefaultCreationTest() + { + await SetCollectionsAsync(); + + var redisCacheName = Recording.GenerateAssetName("RedisUpdateChannel"); + var parameter = new RedisCreateOrUpdateContent(DefaultLocation, new RedisSku(RedisSkuName.Basic, RedisSkuFamily.BasicOrStandard, 0)); + + var responseCreate = (await Collection.CreateOrUpdateAsync(WaitUntil.Completed, redisCacheName, parameter)).Value; + + Assert.AreEqual(DefaultLocation, responseCreate.Data.Location); + Assert.AreEqual(redisCacheName, responseCreate.Data.Name); + Assert.AreEqual(RedisSkuName.Basic, responseCreate.Data.Sku.Name); + Assert.AreEqual(RedisSkuFamily.BasicOrStandard, responseCreate.Data.Sku.Family); + Assert.AreEqual(0, responseCreate.Data.Sku.Capacity); + Assert.AreEqual(6379, responseCreate.Data.Port); + Assert.AreEqual(6380, responseCreate.Data.SslPort); + Assert.AreEqual(UpdateChannel.Stable, responseCreate.Data.UpdateChannel); + + var patch = new RedisPatch() + { + RedisVersion = "6.0", + UpdateChannel = UpdateChannel.Preview + }; + + var responseUpdate = (await responseCreate.UpdateAsync(WaitUntil.Completed, patch)).Value; + var response = (await ResourceGroup.GetAllRedis().GetAsync(redisCacheName)).Value; + Assert.AreEqual(UpdateChannel.Preview, response.Data.UpdateChannel); + + await responseUpdate.DeleteAsync(WaitUntil.Completed); + var falseResult = (await Collection.ExistsAsync(redisCacheName)).Value; + Assert.IsFalse(falseResult); + } + } +} diff --git a/sdk/redis/test-resources.json b/sdk/redis/test-resources.json new file mode 100644 index 0000000000000..a837d5a0f2b84 --- /dev/null +++ b/sdk/redis/test-resources.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [ + ] +}