From 4b5655ab8c5c9d695188521a3290995c89473ff4 Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Tue, 26 Aug 2025 16:09:46 +0800 Subject: [PATCH 1/4] Generate from TypeSpec --- .../src/Generated/ArmRedisModelFactory.cs | 668 +++------ .../MockableRedisResourceGroupResource.cs | 20 +- .../MockableRedisSubscriptionResource.cs | 166 ++- .../Extensions/MockableRedisTenantResource.cs | 95 ++ .../Generated/Extensions/RedisExtensions.cs | 191 ++- .../Internal/BicepSerializationHelpers.cs | 58 - .../Generated/Internal/WirePathAttribute.cs | 27 - .../OperationStatusResultOperationSource.cs | 9 +- ...rce.cs => RedisResourceOperationSource.cs} | 8 +- ...AccessPolicyAssignmentProvisioningState.cs | 12 +- .../Models/AccessPolicyProvisioningState.cs | 12 +- .../src/Generated/Models/AccessPolicyType.cs | 4 +- .../AzureResourceManagerRedisContext.cs | 31 +- ...kNameAvailabilityContent.Serialization.cs} | 44 +- ...ent.cs => CheckNameAvailabilityContent.cs} | 30 +- .../Models/DayOfWeek.Serialization.cs | 42 + .../{RedisDayOfWeek.cs => DayOfWeek.cs} | 6 +- .../src/Generated/Models/DefaultName.cs | 48 + .../Models/ExportRdbContent.Serialization.cs | 38 +- .../src/Generated/Models/ExportRdbContent.cs | 19 +- .../Models/ImportRdbContent.Serialization.cs | 38 +- .../src/Generated/Models/ImportRdbContent.cs | 18 +- .../NotificationListResponse.Serialization.cs | 151 +++ .../Models/NotificationListResponse.cs | 80 ++ .../Models/Operation.Serialization.cs | 144 ++ .../src/Generated/Models/Operation.cs | 69 + .../Models/OperationDisplay.Serialization.cs | 162 +++ .../src/Generated/Models/OperationDisplay.cs | 77 ++ .../OperationListResult.Serialization.cs | 147 ++ .../Generated/Models/OperationListResult.cs | 80 ++ .../Models/OperationStatus.Serialization.cs | 233 ++++ ...sOperationStatus.cs => OperationStatus.cs} | 55 +- .../OperationStatusResult.Serialization.cs | 243 ++++ .../Generated/Models/OperationStatusResult.cs | 104 ++ .../src/Generated/Models/ProvisioningState.cs | 84 ++ .../src/Generated/Models/RebootType.cs | 54 + .../Models/RedisAccessKeys.Serialization.cs | 64 - .../src/Generated/Models/RedisAccessKeys.cs | 2 - ...ccessPolicyAssignmentList.Serialization.cs | 96 +- .../RedisCacheAccessPolicyAssignmentList.cs | 26 +- ...edisCacheAccessPolicyList.Serialization.cs | 96 +- .../Models/RedisCacheAccessPolicyList.cs | 26 +- .../RedisCommonConfiguration.Serialization.cs | 774 ----------- .../Models/RedisCommonConfiguration.cs | 157 --- ...edisCreateOrUpdateContent.Serialization.cs | 455 ------- .../Models/RedisCreateOrUpdateContent.cs | 174 --- .../Models/RedisDayOfWeek.Serialization.cs | 42 - ...disFirewallRuleListResult.Serialization.cs | 96 +- .../Models/RedisFirewallRuleListResult.cs | 28 +- ...RedisForceRebootResponse.Serialization.cs} | 79 +- ...tResult.cs => RedisForceRebootResponse.cs} | 11 +- .../RedisInstanceDetails.Serialization.cs | 118 -- .../Generated/Models/RedisInstanceDetails.cs | 6 - .../Models/RedisKeyType.Serialization.cs | 28 + ...isRegenerateKeyType.cs => RedisKeyType.cs} | 6 +- .../RedisLinkedServerRole.Serialization.cs | 28 - ...dServerWithPropertiesList.Serialization.cs | 96 +- .../RedisLinkedServerWithPropertiesList.cs | 26 +- ...ertyCreateOrUpdateContent.Serialization.cs | 12 +- ...ServerWithPropertyCreateOrUpdateContent.cs | 19 +- .../Models/RedisListResult.Serialization.cs | 102 +- .../src/Generated/Models/RedisListResult.cs | 28 +- .../RedisOperationStatus.Serialization.cs | 446 ------ .../Models/RedisPatch.Serialization.cs | 394 ------ .../src/Generated/Models/RedisPatch.cs | 139 -- .../Models/RedisPatchScheduleDefaultName.cs | 48 - ...isPatchScheduleListResult.Serialization.cs | 96 +- .../Models/RedisPatchScheduleListResult.cs | 28 +- ...RedisPatchScheduleSetting.Serialization.cs | 207 --- ...pointConnectionListResult.Serialization.cs | 76 +- ...edisPrivateEndpointConnectionListResult.cs | 26 +- ...vateEndpointConnectionProvisioningState.cs | 8 +- ...sPrivateEndpointServiceConnectionStatus.cs | 6 +- .../RedisPrivateLinkResource.Serialization.cs | 387 ------ ...isPrivateLinkResourceData.Serialization.cs | 155 +++ ...nse.cs => RedisPrivateLinkResourceData.cs} | 31 +- ...ateLinkResourceListResult.Serialization.cs | 82 +- .../RedisPrivateLinkResourceListResult.cs | 28 +- ...ateLinkResourceProperties.Serialization.cs | 179 +++ ... => RedisPrivateLinkResourceProperties.cs} | 27 +- ...inkServiceConnectionState.Serialization.cs | 79 -- .../RedisPrivateLinkServiceConnectionState.cs | 3 - .../Models/RedisProvisioningState.cs | 84 -- .../Models/RedisPublicNetworkAccess.cs | 51 - .../RedisRebootContent.Serialization.cs | 4 +- .../Generated/Models/RedisRebootContent.cs | 7 +- .../src/Generated/Models/RedisRebootType.cs | 54 - ...RedisRegenerateKeyContent.Serialization.cs | 4 +- .../Models/RedisRegenerateKeyContent.cs | 7 +- .../RedisRegenerateKeyType.Serialization.cs | 28 - ...urceCreateOrUpdateContent.Serialization.cs | 247 ++++ .../RedisResourceCreateOrUpdateContent.cs | 105 ++ .../RedisResourcePatch.Serialization.cs | 191 +++ .../Generated/Models/RedisResourcePatch.cs | 75 + .../Models/RedisSku.Serialization.cs | 54 - .../src/Generated/Models/RedisSku.cs | 3 - .../src/Generated/Models/RedisSkuFamily.cs | 12 +- .../src/Generated/Models/RedisSkuName.cs | 6 +- .../src/Generated/Models/RedisTlsVersion.cs | 47 - .../RedisUpgradeNotification.Serialization.cs | 265 ---- ...eNotificationListResponse.Serialization.cs | 219 --- .../Models/ReplicationRole.Serialization.cs | 28 + ...LinkedServerRole.cs => ReplicationRole.cs} | 6 +- .../Models/ScheduleEntry.Serialization.cs | 149 ++ ...tchScheduleSetting.cs => ScheduleEntry.cs} | 19 +- .../src/Generated/Models/UpdateChannel.cs | 51 - .../UpgradeNotification.Serialization.cs | 170 +++ ...Notification.cs => UpgradeNotification.cs} | 13 +- .../Generated/Models/ZonalAllocationPolicy.cs | 54 - ...isCacheAccessPolicyAssignmentCollection.cs | 78 +- ...ccessPolicyAssignmentData.Serialization.cs | 159 +-- .../RedisCacheAccessPolicyAssignmentData.cs | 8 +- ...edisCacheAccessPolicyAssignmentResource.cs | 54 +- .../RedisCacheAccessPolicyCollection.cs | 78 +- ...edisCacheAccessPolicyData.Serialization.cs | 130 +- .../Generated/RedisCacheAccessPolicyData.cs | 11 +- .../RedisCacheAccessPolicyResource.cs | 54 +- .../src/Generated/RedisData.Serialization.cs | 1207 ----------------- .../src/Generated/RedisData.cs | 216 --- .../Generated/RedisFirewallRuleCollection.cs | 78 +- .../RedisFirewallRuleData.Serialization.cs | 116 +- .../src/Generated/RedisFirewallRuleData.cs | 13 +- .../Generated/RedisFirewallRuleResource.cs | 54 +- ...RedisLinkedServerWithPropertyCollection.cs | 32 +- ...kedServerWithPropertyData.Serialization.cs | 260 ---- .../RedisLinkedServerWithPropertyData.cs | 31 +- .../RedisLinkedServerWithPropertyResource.cs | 8 +- .../Generated/RedisPatchScheduleCollection.cs | 110 +- .../RedisPatchScheduleData.Serialization.cs | 130 +- .../src/Generated/RedisPatchScheduleData.cs | 16 +- .../Generated/RedisPatchScheduleResource.cs | 60 +- ...edisPrivateEndpointConnectionCollection.cs | 26 +- ...ateEndpointConnectionData.Serialization.cs | 131 +- .../RedisPrivateEndpointConnectionData.cs | 21 +- .../RedisPrivateEndpointConnectionResource.cs | 12 +- .../Generated/RedisResource.Serialization.cs | 16 +- .../src/Generated/RedisResource.cs | 327 ++--- ...llection.cs => RedisResourceCollection.cs} | 110 +- .../RedisResourceData.Serialization.cs | 388 ++++++ .../src/Generated/RedisResourceData.cs | 132 ++ ...tionStatusOperationGroupRestOperations.cs} | 48 +- .../LinkedServerRestOperations.cs | 167 ++- .../OperationsRestOperations.cs | 173 +++ ...rivateEndpointConnectionsRestOperations.cs | 287 ++-- .../PrivateLinkResourcesRestOperations.cs | 133 -- ...RedisCacheAccessPoliciesRestOperations.cs} | 157 ++- ...eAccessPolicyAssignmentsRestOperations.cs} | 157 ++- ...cs => RedisFirewallRulesRestOperations.cs} | 167 ++- .../RedisOperationGroupRestOperations.cs | 113 ++ ...s => RedisPatchSchedulesRestOperations.cs} | 187 ++- ...ons.cs => RedisResourcesRestOperations.cs} | 639 +++++---- .../src/{autorest.md => autorest.md.bak} | 2 +- ...isCacheAccessPolicyAssignmentCollection.cs | 201 --- ...edisCacheAccessPolicyAssignmentResource.cs | 114 -- ...Sample_RedisCacheAccessPolicyCollection.cs | 199 --- .../Sample_RedisCacheAccessPolicyResource.cs | 112 -- .../Samples/Sample_RedisCollection.cs | 451 ------ .../Sample_RedisFirewallRuleCollection.cs | 197 --- .../Sample_RedisFirewallRuleResource.cs | 110 -- ...RedisLinkedServerWithPropertyCollection.cs | 40 +- ...e_RedisLinkedServerWithPropertyResource.cs | 12 +- .../Sample_RedisPatchScheduleCollection.cs | 205 --- .../Sample_RedisPatchScheduleResource.cs | 118 -- ...edisPrivateEndpointConnectionCollection.cs | 50 +- ..._RedisPrivateEndpointConnectionResource.cs | 22 +- .../Generated/Samples/Sample_RedisResource.cs | 345 ----- .../Sample_SubscriptionResourceExtensions.cs | 102 -- .../Sample_TenantResourceExtensions.cs | 43 + .../tsp-location.yaml | 3 + 169 files changed, 6563 insertions(+), 12317 deletions(-) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisTenantResource.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/BicepSerializationHelpers.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/WirePathAttribute.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/{RedisOperationSource.cs => RedisResourceOperationSource.cs} (65%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisNameAvailabilityContent.Serialization.cs => CheckNameAvailabilityContent.Serialization.cs} (73%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisNameAvailabilityContent.cs => CheckNameAvailabilityContent.cs} (66%) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DayOfWeek.Serialization.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisDayOfWeek.cs => DayOfWeek.cs} (70%) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DefaultName.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/NotificationListResponse.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/NotificationListResponse.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatus.Serialization.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisOperationStatus.cs => OperationStatus.cs} (53%) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RebootType.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.Serialization.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.Serialization.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisDayOfWeek.Serialization.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisForceRebootResult.Serialization.cs => RedisForceRebootResponse.Serialization.cs} (52%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisForceRebootResult.cs => RedisForceRebootResponse.cs} (87%) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisKeyType.Serialization.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisRegenerateKeyType.cs => RedisKeyType.cs} (66%) delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerRole.Serialization.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.Serialization.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.Serialization.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleDefaultName.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.Serialization.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResource.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceData.Serialization.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisUpgradeNotificationListResponse.cs => RedisPrivateLinkResourceData.cs} (65%) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceProperties.Serialization.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisPrivateLinkResource.cs => RedisPrivateLinkResourceProperties.cs} (70%) delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisProvisioningState.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPublicNetworkAccess.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootType.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyType.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourceCreateOrUpdateContent.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourceCreateOrUpdateContent.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourcePatch.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourcePatch.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisTlsVersion.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.Serialization.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ReplicationRole.Serialization.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisLinkedServerRole.cs => ReplicationRole.cs} (58%) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ScheduleEntry.Serialization.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisPatchScheduleSetting.cs => ScheduleEntry.cs} (77%) delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpdateChannel.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpgradeNotification.Serialization.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisUpgradeNotification.cs => UpgradeNotification.cs} (82%) delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ZonalAllocationPolicy.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.Serialization.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/{RedisCollection.cs => RedisResourceCollection.cs} (76%) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/{AsyncOperationStatusRestOperations.cs => AsyncOperationStatusOperationGroupRestOperations.cs} (69%) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/OperationsRestOperations.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/{AccessPolicyRestOperations.cs => RedisCacheAccessPoliciesRestOperations.cs} (97%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/{AccessPolicyAssignmentRestOperations.cs => RedisCacheAccessPolicyAssignmentsRestOperations.cs} (97%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/{FirewallRulesRestOperations.cs => RedisFirewallRulesRestOperations.cs} (97%) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisOperationGroupRestOperations.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/{PatchSchedulesRestOperations.cs => RedisPatchSchedulesRestOperations.cs} (89%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/{RedisRestOperations.cs => RedisResourcesRestOperations.cs} (82%) rename sdk/redis/Azure.ResourceManager.Redis/src/{autorest.md => autorest.md.bak} (96%) delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentCollection.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentResource.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyCollection.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyResource.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCollection.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisFirewallRuleCollection.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisFirewallRuleResource.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPatchScheduleCollection.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPatchScheduleResource.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisResource.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_TenantResourceExtensions.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/tsp-location.yaml diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs index 02924f080135..709df64fed34 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs @@ -7,9 +7,7 @@ using System; using System.Collections.Generic; -using System.ComponentModel; using System.Linq; -using System.Net; using Azure.Core; using Azure.ResourceManager.Models; using Azure.ResourceManager.Resources.Models; @@ -19,192 +17,24 @@ namespace Azure.ResourceManager.Redis.Models /// Model factory for models. public static partial class ArmRedisModelFactory { - /// Initializes a new instance of . - /// Name of upgrade notification. - /// Timestamp when upgrade notification occurred. - /// Details about this upgrade notification. - /// A new instance for mocking. - public static RedisUpgradeNotification RedisUpgradeNotification(string name = null, DateTimeOffset? timestamp = null, IReadOnlyDictionary upsellNotification = null) + /// Initializes a new instance of . + /// Operation name: {provider}/{resource}/{operation}. + /// The object that describes the operation. + /// A new instance for mocking. + public static Operation Operation(string name = null, OperationDisplay display = null) { - upsellNotification ??= new Dictionary(); - - return new RedisUpgradeNotification(name, timestamp, upsellNotification, serializedAdditionalRawData: null); + return new Operation(name, display, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// A list of availability zones denoting where the resource needs to come from. - /// The geo-location where the resource lives. - /// Resource tags. - /// 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, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-1 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'. - /// 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'. - /// Authentication to Redis through access keys is disabled when set as true. Default value is false. - /// Optional: Specifies how availability zones are allocated to the Redis cache. 'Automatic' enables zone redundancy and Azure will automatically select zones based on regional availability and capacity. 'UserDefined' will select availability zones passed in by you using the 'zones' parameter. 'NoZones' will produce a non-zonal cache. If 'zonalAllocationPolicy' is not passed, it will be set to 'UserDefined' when zones are passed in, otherwise, it will be set to 'Automatic' in regions where zones are supported and 'NoZones' in regions where zones are not supported. - /// 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. - /// A new instance for mocking. - public static RedisCreateOrUpdateContent RedisCreateOrUpdateContent(IEnumerable zones = null, AzureLocation location = default, IDictionary tags = 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, bool? isAccessKeyAuthenticationDisabled = null, ZonalAllocationPolicy? zonalAllocationPolicy = null, RedisSku sku = null, ResourceIdentifier subnetId = null, IPAddress staticIP = null) - { - zones ??= new List(); - tags ??= new Dictionary(); - tenantSettings ??= new Dictionary(); - - return new RedisCreateOrUpdateContent( - zones?.ToList(), - location, - tags, - identity, - redisConfiguration, - redisVersion, - enableNonSslPort, - replicasPerMaster, - replicasPerPrimary, - tenantSettings, - shardCount, - minimumTlsVersion, - publicNetworkAccess, - updateChannel, - isAccessKeyAuthenticationDisabled, - zonalAllocationPolicy, - sku, - subnetId, - staticIP, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// 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. - /// The keyspace events which should be monitored. - /// 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. - /// 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 notifyKeyspaceEvents = 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, - notifyKeyspaceEvents, - preferredDataArchiveAuthMethod, - preferredDataPersistenceAuthMethod, - zonalConfiguration, - authNotRequired, - storageSubscriptionId, - isAadEnabled, - additionalProperties); - } - - /// Initializes a new instance of . - /// 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, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-1 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'. - /// 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'. - /// Authentication to Redis through access keys is disabled when set as true. Default value is false. - /// Optional: Specifies how availability zones are allocated to the Redis cache. 'Automatic' enables zone redundancy and Azure will automatically select zones based on regional availability and capacity. 'UserDefined' will select availability zones passed in by you using the 'zones' parameter. 'NoZones' will produce a non-zonal cache. If 'zonalAllocationPolicy' is not passed, it will be set to 'UserDefined' when zones are passed in, otherwise, it will be set to 'Automatic' in regions where zones are supported and 'NoZones' in regions where zones are not supported. - /// 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. - 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, bool? isAccessKeyAuthenticationDisabled = null, ZonalAllocationPolicy? zonalAllocationPolicy = 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) + /// Initializes a new instance of . + /// Friendly name of the resource provider. + /// Operation type: read, write, delete, listKeys/action, etc. + /// Resource type on which the operation is performed. + /// Friendly name of the operation. + /// A new instance for mocking. + public static OperationDisplay OperationDisplay(string provider = null, string operation = null, string resource = null, string description = 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, - updateChannel, - isAccessKeyAuthenticationDisabled, - zonalAllocationPolicy, - sku, - subnetId, - staticIP, - provisioningState, - hostName, - port, - sslPort, - accessKeys, - linkedServers?.ToList(), - instances?.ToList(), - privateEndpointConnections?.ToList(), - serializedAdditionalRawData: null); + return new OperationDisplay(provider, operation, resource, description, serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -241,11 +71,11 @@ public static RedisInstanceDetails RedisInstanceDetails(int? sslPort = null, int /// The name. /// The resourceType. /// The systemData. - /// The resource of private end point. - /// A collection of information about the state of the connection between service consumer and provider. - /// The provisioning state of the private endpoint connection resource. + /// The private endpoint resource. + /// A collection of information about the state of the connection between service consumer and provider. + /// The provisioning state of the private endpoint connection resource. /// A new instance for mocking. - public static RedisPrivateEndpointConnectionData RedisPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier privateEndpointId = null, RedisPrivateLinkServiceConnectionState redisPrivateLinkServiceConnectionState = null, RedisPrivateEndpointConnectionProvisioningState? redisProvisioningState = null) + public static RedisPrivateEndpointConnectionData RedisPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier privateEndpointId = null, RedisPrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, RedisPrivateEndpointConnectionProvisioningState? provisioningState = null) { return new RedisPrivateEndpointConnectionData( id, @@ -253,29 +83,66 @@ public static RedisPrivateEndpointConnectionData RedisPrivateEndpointConnectionD resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, - redisPrivateLinkServiceConnectionState, - redisProvisioningState, + privateLinkServiceConnectionState, + provisioningState, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// 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. + /// A list of availability zones denoting where the resource needs to come from. + /// The geo-location where the resource lives. + /// Resource tags. + /// The identity of the resource. + /// A new instance for mocking. + public static RedisResourceCreateOrUpdateContent RedisResourceCreateOrUpdateContent(RedisSku sku = null, string subnetId = null, string staticIP = null, IEnumerable zones = null, string location = null, IDictionary tags = null, ManagedServiceIdentity identity = null) + { + zones ??= new List(); + tags ??= new Dictionary(); + + return new RedisResourceCreateOrUpdateContent( + sku, + subnetId, + staticIP, + zones?.ToList(), + location, + tags, + identity, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Name of upgrade notification. + /// Timestamp when upgrade notification occurred. + /// Details about this upgrade notification. + /// A new instance for mocking. + public static UpgradeNotification UpgradeNotification(string name = null, DateTimeOffset? timestamp = null, IReadOnlyDictionary upsellNotification = null) + { + upsellNotification ??= new Dictionary(); + + return new UpgradeNotification(name, timestamp, upsellNotification, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// Status message. - /// A new instance for mocking. - public static RedisForceRebootResult RedisForceRebootResult(string message = null) + /// A new instance for mocking. + public static RedisForceRebootResponse RedisForceRebootResponse(string message = null) { - return new RedisForceRebootResult(message, serializedAdditionalRawData: null); + return new RedisForceRebootResponse(message, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// File format. /// Prefix to use for exported files. /// Container name to export to. /// Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. /// Subscription id of the storage container for data to be exported using ManagedIdentity. - /// A new instance for mocking. - public static ExportRdbContent ExportRdbContent(string format = null, string prefix = null, string container = null, string preferredDataArchiveAuthMethod = null, string storageSubscriptionId = null) + /// A new instance for mocking. + public static ExportRDBContent ExportRDBContent(string format = null, string prefix = null, string container = null, string preferredDataArchiveAuthMethod = null, string storageSubscriptionId = null) { - return new ExportRdbContent( + return new ExportRDBContent( format, prefix, container, @@ -284,6 +151,63 @@ public static ExportRdbContent ExportRdbContent(string format = null, string pre serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// Fully qualified ID for the async operation. + /// Name of the async operation. + /// Operation status. + /// Percent of the operation that is complete. + /// The start time of the operation. + /// The end time of the operation. + /// The operations list. + /// If present, details of the operation error. + /// A new instance for mocking. + public static OperationStatusResult OperationStatusResult(string id = null, string name = null, string status = null, double? percentComplete = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, IEnumerable operations = null, ResponseError error = null) + { + operations ??= new List(); + + return new OperationStatusResult( + id, + name, + status, + percentComplete, + startOn, + endOn, + operations?.ToList(), + error, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource properties. + /// A new instance for mocking. + public static RedisPrivateLinkResourceData RedisPrivateLinkResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, RedisPrivateLinkResourceProperties properties = null) + { + return new RedisPrivateLinkResourceData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The private link resource group id. + /// The private link resource required member names. + /// The private link resource private link DNS zone name. + /// A new instance for mocking. + public static RedisPrivateLinkResourceProperties RedisPrivateLinkResourceProperties(string groupId = null, IEnumerable requiredMembers = null, IEnumerable requiredZoneNames = null) + { + requiredMembers ??= new List(); + requiredZoneNames ??= new List(); + + return new RedisPrivateLinkResourceProperties(groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList(), serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -292,7 +216,7 @@ public static ExportRdbContent ExportRdbContent(string format = null, string pre /// lowest IP address included in the range. /// highest IP address included in the range. /// A new instance for mocking. - public static RedisFirewallRuleData RedisFirewallRuleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IPAddress startIP = null, IPAddress endIP = null) + public static RedisFirewallRuleData RedisFirewallRuleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string startIP = null, string endIP = null) { return new RedisFirewallRuleData( id, @@ -309,38 +233,20 @@ public static RedisFirewallRuleData RedisFirewallRuleData(ResourceIdentifier id /// The name. /// The resourceType. /// The systemData. - /// The geo-location where the resource lives. /// List of patch schedules for a Redis cache. + /// The geo-location where the resource lives. /// A new instance for mocking. - public static RedisPatchScheduleData RedisPatchScheduleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, IEnumerable scheduleEntries = null) + public static RedisPatchScheduleData RedisPatchScheduleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable scheduleEntries = null, string location = null) { - scheduleEntries ??= new List(); + scheduleEntries ??= new List(); return new RedisPatchScheduleData( id, name, resourceType, systemData, - location, scheduleEntries?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Fully qualified resourceId of the linked redis cache. - /// Location of the linked redis cache. - /// Role of the linked server. - /// The unchanging DNS name which will always point to current geo-primary cache among the linked redis caches for seamless Geo Failover experience. - /// The changing DNS name that resolves to the current geo-primary cache among the linked redis caches before or after the Geo Failover. - /// A new instance for mocking. - public static RedisLinkedServerWithPropertyCreateOrUpdateContent RedisLinkedServerWithPropertyCreateOrUpdateContent(ResourceIdentifier linkedRedisCacheId = null, AzureLocation linkedRedisCacheLocation = default, RedisLinkedServerRole serverRole = default, string geoReplicatedPrimaryHostName = null, string primaryHostName = null) - { - return new RedisLinkedServerWithPropertyCreateOrUpdateContent( - linkedRedisCacheId, - linkedRedisCacheLocation, - serverRole, - geoReplicatedPrimaryHostName, - primaryHostName, + location, serializedAdditionalRawData: null); } @@ -349,80 +255,34 @@ public static RedisLinkedServerWithPropertyCreateOrUpdateContent RedisLinkedServ /// The name. /// The resourceType. /// The systemData. - /// Fully qualified resourceId of the linked redis cache. - /// Location of the linked redis cache. - /// Role of the linked server. - /// The unchanging DNS name which will always point to current geo-primary cache among the linked redis caches for seamless Geo Failover experience. - /// The changing DNS name that resolves to the current geo-primary cache among the linked redis caches before or after the Geo Failover. /// Terminal state of the link between primary and secondary redis cache. /// A new instance for mocking. - public static RedisLinkedServerWithPropertyData RedisLinkedServerWithPropertyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier linkedRedisCacheId = null, AzureLocation? linkedRedisCacheLocation = null, RedisLinkedServerRole? serverRole = null, string geoReplicatedPrimaryHostName = null, string primaryHostName = null, string provisioningState = null) + public static RedisLinkedServerWithPropertyData RedisLinkedServerWithPropertyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string provisioningState = null) { return new RedisLinkedServerWithPropertyData( id, name, resourceType, systemData, - linkedRedisCacheId, - linkedRedisCacheLocation, - serverRole, - geoReplicatedPrimaryHostName, - primaryHostName, provisioningState, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The private link resource group id. - /// The private link resource required member names. - /// The private link resource Private link DNS zone name. - /// A new instance for mocking. - public static RedisPrivateLinkResource RedisPrivateLinkResource(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string groupId = null, IEnumerable requiredMembers = null, IEnumerable requiredZoneNames = null) - { - requiredMembers ??= new List(); - requiredZoneNames ??= new List(); - - return new RedisPrivateLinkResource( - id, - name, - resourceType, - systemData, - groupId, - requiredMembers?.ToList(), - requiredZoneNames?.ToList(), - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Fully qualified ID for the async operation. - /// Name of the async operation. - /// Operation status. - /// Percent of the operation that is complete. - /// The start time of the operation. - /// The end time of the operation. - /// The operations list. - /// If present, details of the operation error. - /// Additional properties from RP, only when operation is successful. - /// A new instance for mocking. - public static RedisOperationStatus RedisOperationStatus(ResourceIdentifier id = null, string name = null, string status = null, float? percentComplete = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, IEnumerable operations = null, ResponseError error = null, IReadOnlyDictionary properties = null) + /// Initializes a new instance of . + /// Fully qualified resourceId of the linked redis cache. + /// Location of the linked redis cache. + /// Role of the linked server. + /// The unchanging DNS name which will always point to current geo-primary cache among the linked redis caches for seamless Geo Failover experience. + /// The changing DNS name that resolves to the current geo-primary cache among the linked redis caches before or after the Geo Failover. + /// A new instance for mocking. + public static RedisLinkedServerWithPropertyCreateOrUpdateContent RedisLinkedServerWithPropertyCreateOrUpdateContent(string linkedRedisCacheId = null, string linkedRedisCacheLocation = null, ReplicationRole serverRole = default, string geoReplicatedPrimaryHostName = null, string primaryHostName = null) { - operations ??= new List(); - properties ??= new Dictionary(); - - return new RedisOperationStatus( - id, - name, - status, - percentComplete, - startOn, - endOn, - operations?.ToList(), - error, - properties, + return new RedisLinkedServerWithPropertyCreateOrUpdateContent( + linkedRedisCacheId, + linkedRedisCacheLocation, + serverRole, + geoReplicatedPrimaryHostName, + primaryHostName, serializedAdditionalRawData: null); } @@ -432,10 +292,10 @@ public static RedisOperationStatus RedisOperationStatus(ResourceIdentifier id = /// The resourceType. /// The systemData. /// Provisioning state of access policy. - /// Built-In or Custom 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) + public static RedisCacheAccessPolicyData RedisCacheAccessPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AccessPolicyProvisioningState? provisioningState = null, AccessPolicyType? type = null, string permissions = null) { return new RedisCacheAccessPolicyData( id, @@ -443,7 +303,7 @@ public static RedisCacheAccessPolicyData RedisCacheAccessPolicyData(ResourceIden resourceType, systemData, provisioningState, - typePropertiesType, + type, permissions, serializedAdditionalRawData: null); } @@ -458,7 +318,7 @@ public static RedisCacheAccessPolicyData RedisCacheAccessPolicyData(ResourceIden /// 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) + public static RedisCacheAccessPolicyAssignmentData RedisCacheAccessPolicyAssignmentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AccessPolicyAssignmentProvisioningState? provisioningState = null, string objectId = null, string objectIdAlias = null, string accessPolicyName = null) { return new RedisCacheAccessPolicyAssignmentData( id, @@ -472,219 +332,33 @@ public static RedisCacheAccessPolicyAssignmentData RedisCacheAccessPolicyAssignm serializedAdditionalRawData: null); } - /// 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, 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) - { - return RedisCommonConfiguration(isRdbBackupEnabled: isRdbBackupEnabled, rdbBackupFrequency: rdbBackupFrequency, rdbBackupMaxSnapshotCount: rdbBackupMaxSnapshotCount, rdbStorageConnectionString: rdbStorageConnectionString, isAofBackupEnabled: isAofBackupEnabled, aofStorageConnectionString0: aofStorageConnectionString0, aofStorageConnectionString1: aofStorageConnectionString1, maxFragmentationMemoryReserved: maxFragmentationMemoryReserved, maxMemoryPolicy: maxMemoryPolicy, maxMemoryReserved: maxMemoryReserved, maxMemoryDelta: maxMemoryDelta, maxClients: maxClients, notifyKeyspaceEvents: default, preferredDataArchiveAuthMethod: preferredDataArchiveAuthMethod, preferredDataPersistenceAuthMethod: preferredDataPersistenceAuthMethod, zonalConfiguration: zonalConfiguration, authNotRequired: authNotRequired, storageSubscriptionId: storageSubscriptionId, isAadEnabled: default, additionalProperties: 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, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IEnumerable 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, IEnumerable linkedServers, IEnumerable instances, IEnumerable privateEndpointConnections) - { - return RedisData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, zones: zones, identity: identity, redisConfiguration: redisConfiguration, redisVersion: redisVersion, enableNonSslPort: enableNonSslPort, replicasPerMaster: replicasPerMaster, replicasPerPrimary: replicasPerPrimary, tenantSettings: tenantSettings, shardCount: shardCount, minimumTlsVersion: minimumTlsVersion, publicNetworkAccess: publicNetworkAccess, updateChannel: default, isAccessKeyAuthenticationDisabled: default, zonalAllocationPolicy: default, sku: sku, subnetId: subnetId, staticIP: staticIP, provisioningState: provisioningState, hostName: hostName, port: port, sslPort: sslPort, accessKeys: accessKeys, linkedServers: linkedServers, instances: instances, privateEndpointConnections: privateEndpointConnections); - } - - /// Initializes a new instance of . - /// A list of availability zones denoting where the resource needs to come from. - /// The geo-location where the resource lives. - /// Resource tags. - /// 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, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-1 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'. - /// 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'. - /// Authentication to Redis through access keys is disabled when set as true. Default value is false. - /// 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. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static RedisCreateOrUpdateContent RedisCreateOrUpdateContent(IEnumerable 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, bool? isAccessKeyAuthenticationDisabled, RedisSku sku, ResourceIdentifier subnetId, IPAddress staticIP) - { - return RedisCreateOrUpdateContent(zones: zones, location: location, tags: tags, identity: identity, redisConfiguration: redisConfiguration, redisVersion: redisVersion, enableNonSslPort: enableNonSslPort, replicasPerMaster: replicasPerMaster, replicasPerPrimary: replicasPerPrimary, tenantSettings: tenantSettings, shardCount: shardCount, minimumTlsVersion: minimumTlsVersion, publicNetworkAccess: publicNetworkAccess, updateChannel: updateChannel, isAccessKeyAuthenticationDisabled: isAccessKeyAuthenticationDisabled, zonalAllocationPolicy: default, sku: sku, subnetId: subnetId, staticIP: staticIP); - } - - /// Initializes a new instance of . - /// 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, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-1 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'. - /// 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'. - /// Authentication to Redis through access keys is disabled when set as true. Default value is false. - /// 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, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IEnumerable zones, ManagedServiceIdentity identity, RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, IDictionary tenantSettings, int? shardCount, RedisTlsVersion? minimumTlsVersion, RedisPublicNetworkAccess? publicNetworkAccess, UpdateChannel? updateChannel, bool? isAccessKeyAuthenticationDisabled, RedisSku sku, ResourceIdentifier subnetId, IPAddress staticIP, RedisProvisioningState? provisioningState, string hostName, int? port, int? sslPort, RedisAccessKeys accessKeys, IEnumerable linkedServers, IEnumerable instances, IEnumerable privateEndpointConnections) - { - return RedisData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, zones: zones, identity: identity, redisConfiguration: redisConfiguration, redisVersion: redisVersion, enableNonSslPort: enableNonSslPort, replicasPerMaster: replicasPerMaster, replicasPerPrimary: replicasPerPrimary, tenantSettings: tenantSettings, shardCount: shardCount, minimumTlsVersion: minimumTlsVersion, publicNetworkAccess: publicNetworkAccess, updateChannel: updateChannel, isAccessKeyAuthenticationDisabled: isAccessKeyAuthenticationDisabled, zonalAllocationPolicy: default, sku: sku, subnetId: subnetId, staticIP: staticIP, provisioningState: provisioningState, hostName: hostName, port: port, sslPort: sslPort, accessKeys: accessKeys, linkedServers: linkedServers, instances: instances, privateEndpointConnections: privateEndpointConnections); - } - - /// Initializes a new instance of . - /// A list of availability zones denoting where the resource needs to come from. - /// The geo-location where the resource lives. - /// Resource tags. - /// 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'. - /// 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. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static RedisCreateOrUpdateContent RedisCreateOrUpdateContent(IEnumerable 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) - { - return RedisCreateOrUpdateContent(zones: zones, location: location, tags: tags, identity: identity, redisConfiguration: redisConfiguration, redisVersion: redisVersion, enableNonSslPort: enableNonSslPort, replicasPerMaster: replicasPerMaster, replicasPerPrimary: replicasPerPrimary, tenantSettings: tenantSettings, shardCount: shardCount, minimumTlsVersion: minimumTlsVersion, publicNetworkAccess: publicNetworkAccess, updateChannel: updateChannel, isAccessKeyAuthenticationDisabled: default, zonalAllocationPolicy: default, sku: sku, subnetId: subnetId, staticIP: staticIP); - } - - /// Initializes a new instance of . - /// 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. - /// Specifies whether AAD based authentication has been enabled or disabled for the cache. - /// Additional Properties. - /// A new instance for mocking. - [EditorBrowsable(EditorBrowsableState.Never)] - public static RedisCommonConfiguration 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) + /// Initializes a new instance of . + /// Fully qualified ID for the async operation. + /// Name of the async operation. + /// Operation status. + /// Percent of the operation that is complete. + /// The start time of the operation. + /// The end time of the operation. + /// The operations list. + /// If present, details of the operation error. + /// Additional properties from RP, only when operation is successful. + /// A new instance for mocking. + public static OperationStatus OperationStatus(string id = null, string name = null, string status = null, double? percentComplete = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, IEnumerable operations = null, ResponseError error = null, IReadOnlyDictionary properties = null) { - return RedisCommonConfiguration(isRdbBackupEnabled: isRdbBackupEnabled, rdbBackupFrequency: rdbBackupFrequency, rdbBackupMaxSnapshotCount: rdbBackupMaxSnapshotCount, rdbStorageConnectionString: rdbStorageConnectionString, isAofBackupEnabled: isAofBackupEnabled, aofStorageConnectionString0: aofStorageConnectionString0, aofStorageConnectionString1: aofStorageConnectionString1, maxFragmentationMemoryReserved: maxFragmentationMemoryReserved, maxMemoryPolicy: maxMemoryPolicy, maxMemoryReserved: maxMemoryReserved, maxMemoryDelta: maxMemoryDelta, maxClients: maxClients, notifyKeyspaceEvents: default, preferredDataArchiveAuthMethod: preferredDataArchiveAuthMethod, preferredDataPersistenceAuthMethod: preferredDataPersistenceAuthMethod, zonalConfiguration: zonalConfiguration, authNotRequired: authNotRequired, storageSubscriptionId: storageSubscriptionId, isAadEnabled: isAadEnabled, additionalProperties: additionalProperties); - } + operations ??= new List(); + properties ??= new Dictionary(); - /// Initializes a new instance of . - /// 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'. - /// 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. - /// 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, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IEnumerable 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, IEnumerable linkedServers, IEnumerable instances, IEnumerable privateEndpointConnections) - { - return RedisData(id: id, name: name, resourceType: resourceType, systemData: systemData, tags: tags, location: location, zones: zones, identity: identity, redisConfiguration: redisConfiguration, redisVersion: redisVersion, enableNonSslPort: enableNonSslPort, replicasPerMaster: replicasPerMaster, replicasPerPrimary: replicasPerPrimary, tenantSettings: tenantSettings, shardCount: shardCount, minimumTlsVersion: minimumTlsVersion, publicNetworkAccess: publicNetworkAccess, updateChannel: updateChannel, isAccessKeyAuthenticationDisabled: default, zonalAllocationPolicy: default, sku: sku, subnetId: subnetId, staticIP: staticIP, provisioningState: provisioningState, hostName: hostName, port: port, sslPort: sslPort, accessKeys: accessKeys, linkedServers: linkedServers, instances: instances, privateEndpointConnections: privateEndpointConnections); + return new OperationStatus( + id, + name, + status, + percentComplete, + startOn, + endOn, + operations?.ToList(), + error, + serializedAdditionalRawData: null, + properties); } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisResourceGroupResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisResourceGroupResource.cs index 9e73be9b6305..b222a461a83e 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisResourceGroupResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisResourceGroupResource.cs @@ -35,9 +35,9 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// Gets a collection of RedisResources in the ResourceGroupResource. /// An object representing collection of RedisResources and their operations over a RedisResource. - public virtual RedisCollection GetAllRedis() + public virtual RedisResourceCollection GetRedisResources() { - return GetCachedClient(client => new RedisCollection(client, Id)); + return GetCachedClient(client => new RedisResourceCollection(client, Id)); } /// @@ -49,7 +49,7 @@ public virtual RedisCollection GetAllRedis() /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -61,14 +61,14 @@ public virtual RedisCollection GetAllRedis() /// /// /// - /// The name of the Redis cache. + /// The name of the RedisResource. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetRedisAsync(string name, CancellationToken cancellationToken = default) + public virtual async Task> GetRedisResourceAsync(string name, CancellationToken cancellationToken = default) { - return await GetAllRedis().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetRedisResources().GetAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -80,7 +80,7 @@ public virtual async Task> GetRedisAsync(string name, Ca /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -92,14 +92,14 @@ public virtual async Task> GetRedisAsync(string name, Ca /// /// /// - /// The name of the Redis cache. + /// The name of the RedisResource. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetRedis(string name, CancellationToken cancellationToken = default) + public virtual Response GetRedisResource(string name, CancellationToken cancellationToken = default) { - return GetAllRedis().Get(name, cancellationToken); + return GetRedisResources().Get(name, cancellationToken); } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisSubscriptionResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisSubscriptionResource.cs index a341e54aaa08..2b1274970bf3 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisSubscriptionResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisSubscriptionResource.cs @@ -18,10 +18,12 @@ namespace Azure.ResourceManager.Redis.Mocking /// A class to add extension methods to SubscriptionResource. public partial class MockableRedisSubscriptionResource : ArmResource { - private ClientDiagnostics _redisClientDiagnostics; - private RedisRestOperations _redisRestClient; - private ClientDiagnostics _asyncOperationStatusClientDiagnostics; - private AsyncOperationStatusRestOperations _asyncOperationStatusRestClient; + private ClientDiagnostics _redisResourceClientDiagnostics; + private RedisResourcesRestOperations _redisResourceRestClient; + private ClientDiagnostics _redisOperationGroupClientDiagnostics; + private RedisOperationGroupRestOperations _redisOperationGroupRestClient; + private ClientDiagnostics _asyncOperationStatusOperationGroupClientDiagnostics; + private AsyncOperationStatusOperationGroupRestOperations _asyncOperationStatusOperationGroupRestClient; /// Initializes a new instance of the class for mocking. protected MockableRedisSubscriptionResource() @@ -35,10 +37,12 @@ internal MockableRedisSubscriptionResource(ArmClient client, ResourceIdentifier { } - private ClientDiagnostics RedisClientDiagnostics => _redisClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Redis", RedisResource.ResourceType.Namespace, Diagnostics); - private RedisRestOperations RedisRestClient => _redisRestClient ??= new RedisRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RedisResource.ResourceType)); - private ClientDiagnostics AsyncOperationStatusClientDiagnostics => _asyncOperationStatusClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Redis", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private AsyncOperationStatusRestOperations AsyncOperationStatusRestClient => _asyncOperationStatusRestClient ??= new AsyncOperationStatusRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics RedisResourceClientDiagnostics => _redisResourceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Redis", RedisResource.ResourceType.Namespace, Diagnostics); + private RedisResourcesRestOperations RedisResourceRestClient => _redisResourceRestClient ??= new RedisResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RedisResource.ResourceType)); + private ClientDiagnostics RedisOperationGroupClientDiagnostics => _redisOperationGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Redis", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private RedisOperationGroupRestOperations RedisOperationGroupRestClient => _redisOperationGroupRestClient ??= new RedisOperationGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics AsyncOperationStatusOperationGroupClientDiagnostics => _asyncOperationStatusOperationGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Redis", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private AsyncOperationStatusOperationGroupRestOperations AsyncOperationStatusOperationGroupRestClient => _asyncOperationStatusOperationGroupRestClient ??= new AsyncOperationStatusOperationGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -47,15 +51,15 @@ private string GetApiVersionOrNull(ResourceType resourceType) } /// - /// Checks that the redis cache name is valid and is not already in use. + /// Gets all Redis caches in the specified subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis /// /// /// Operation Id - /// Redis_CheckNameAvailability + /// RedisResource_ListBySubscription /// /// /// Default Api Version @@ -67,37 +71,25 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// - /// Parameters supplied to the CheckNameAvailability Redis operation. The only supported resource type is 'Microsoft.Cache/redis'. /// The cancellation token to use. - /// is null. - public virtual async Task CheckRedisNameAvailabilityAsync(RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable ListBySubscriptionAsync(CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = RedisClientDiagnostics.CreateScope("MockableRedisSubscriptionResource.CheckRedisNameAvailability"); - scope.Start(); - try - { - var response = await RedisRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => RedisResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisResourceData.DeserializeRedisResourceData(e)), RedisResourceClientDiagnostics, Pipeline, "MockableRedisSubscriptionResource.ListBySubscription", "value", "nextLink", cancellationToken); } /// - /// Checks that the redis cache name is valid and is not already in use. + /// Gets all Redis caches in the specified subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis /// /// /// Operation Id - /// Redis_CheckNameAvailability + /// RedisResource_ListBySubscription /// /// /// Default Api Version @@ -109,85 +101,89 @@ public virtual async Task CheckRedisNameAvailabilityAsync(RedisNameAva /// /// /// - /// Parameters supplied to the CheckNameAvailability Redis operation. The only supported resource type is 'Microsoft.Cache/redis'. /// The cancellation token to use. - /// is null. - public virtual Response CheckRedisNameAvailability(RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable ListBySubscription(CancellationToken cancellationToken = default) { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = RedisClientDiagnostics.CreateScope("MockableRedisSubscriptionResource.CheckRedisNameAvailability"); - scope.Start(); - try - { - var response = RedisRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => RedisResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisResourceData.DeserializeRedisResourceData(e)), RedisResourceClientDiagnostics, Pipeline, "MockableRedisSubscriptionResource.ListBySubscription", "value", "nextLink", cancellationToken); } /// - /// Gets all Redis caches in the specified subscription. + /// Checks that the redis cache name is valid and is not already in use. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/checkNameAvailability /// /// /// Operation Id - /// Redis_ListBySubscription + /// RedisOperationGroup_CheckNameAvailability /// /// /// Default Api Version /// 2024-11-01 /// - /// - /// Resource - /// - /// /// /// + /// The request body. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAllRedisAsync(CancellationToken cancellationToken = default) + /// is null. + public virtual async Task CheckNameAvailabilityAsync(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => RedisRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisData.DeserializeRedisData(e)), RedisClientDiagnostics, Pipeline, "MockableRedisSubscriptionResource.GetAllRedis", "value", "nextLink", cancellationToken); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = RedisOperationGroupClientDiagnostics.CreateScope("MockableRedisSubscriptionResource.CheckNameAvailability"); + scope.Start(); + try + { + var response = await RedisOperationGroupRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Gets all Redis caches in the specified subscription. + /// Checks that the redis cache name is valid and is not already in use. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/checkNameAvailability /// /// /// Operation Id - /// Redis_ListBySubscription + /// RedisOperationGroup_CheckNameAvailability /// /// /// Default Api Version /// 2024-11-01 /// - /// - /// Resource - /// - /// /// /// + /// The request body. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAllRedis(CancellationToken cancellationToken = default) + /// is null. + public virtual Response CheckNameAvailability(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => RedisRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisData.DeserializeRedisData(e)), RedisClientDiagnostics, Pipeline, "MockableRedisSubscriptionResource.GetAllRedis", "value", "nextLink", cancellationToken); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = RedisOperationGroupClientDiagnostics.CreateScope("MockableRedisSubscriptionResource.CheckNameAvailability"); + scope.Start(); + try + { + var response = RedisOperationGroupRestClient.CheckNameAvailability(Id.SubscriptionId, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// @@ -199,7 +195,7 @@ public virtual Pageable GetAllRedis(CancellationToken cancellatio /// /// /// Operation Id - /// AsyncOperationStatus_Get + /// AsyncOperationStatusOperationGroup_Get /// /// /// Default Api Version @@ -210,17 +206,18 @@ public virtual Pageable GetAllRedis(CancellationToken cancellatio /// The location at which operation was triggered. /// The ID of asynchronous operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsyncOperationStatusAsync(AzureLocation location, string operationId, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> GetAsync(string location, string operationId, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(location, nameof(location)); Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - using var scope = AsyncOperationStatusClientDiagnostics.CreateScope("MockableRedisSubscriptionResource.GetAsyncOperationStatus"); + using var scope = AsyncOperationStatusOperationGroupClientDiagnostics.CreateScope("MockableRedisSubscriptionResource.Get"); scope.Start(); try { - var response = await AsyncOperationStatusRestClient.GetAsync(Id.SubscriptionId, location, operationId, cancellationToken).ConfigureAwait(false); + var response = await AsyncOperationStatusOperationGroupRestClient.GetAsync(location, operationId, Id.SubscriptionId, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -239,7 +236,7 @@ public virtual async Task> GetAsyncOperationStatu /// /// /// Operation Id - /// AsyncOperationStatus_Get + /// AsyncOperationStatusOperationGroup_Get /// /// /// Default Api Version @@ -250,17 +247,18 @@ public virtual async Task> GetAsyncOperationStatu /// The location at which operation was triggered. /// The ID of asynchronous operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response GetAsyncOperationStatus(AzureLocation location, string operationId, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response Get(string location, string operationId, CancellationToken cancellationToken = default) { + Argument.AssertNotNullOrEmpty(location, nameof(location)); Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); - using var scope = AsyncOperationStatusClientDiagnostics.CreateScope("MockableRedisSubscriptionResource.GetAsyncOperationStatus"); + using var scope = AsyncOperationStatusOperationGroupClientDiagnostics.CreateScope("MockableRedisSubscriptionResource.Get"); scope.Start(); try { - var response = AsyncOperationStatusRestClient.Get(Id.SubscriptionId, location, operationId, cancellationToken); + var response = AsyncOperationStatusOperationGroupRestClient.Get(location, operationId, Id.SubscriptionId, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisTenantResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisTenantResource.cs new file mode 100644 index 000000000000..39d5ecc25e19 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisTenantResource.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Redis.Models; + +namespace Azure.ResourceManager.Redis.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableRedisTenantResource : ArmResource + { + private ClientDiagnostics _operationsClientDiagnostics; + private OperationsRestOperations _operationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableRedisTenantResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableRedisTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics OperationsClientDiagnostics => _operationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Redis", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private OperationsRestOperations OperationsRestClient => _operationsRestClient ??= new OperationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List the operations for the provider + /// + /// + /// Request Path + /// /providers/Microsoft.Cache/operations + /// + /// + /// Operation Id + /// Operations_List + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationsRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationsRestClient.CreateListNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => Models.Operation.DeserializeOperation(e), OperationsClientDiagnostics, Pipeline, "MockableRedisTenantResource.List", "value", "nextLink", cancellationToken); + } + + /// + /// List the operations for the provider + /// + /// + /// Request Path + /// /providers/Microsoft.Cache/operations + /// + /// + /// Operation Id + /// Operations_List + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable List(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OperationsRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationsRestClient.CreateListNextPageRequest(nextLink); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Models.Operation.DeserializeOperation(e), OperationsClientDiagnostics, Pipeline, "MockableRedisTenantResource.List", "value", "nextLink", cancellationToken); + } + } +} 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 c15adfc30d89..093e7f27feda 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/RedisExtensions.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/RedisExtensions.cs @@ -33,6 +33,11 @@ private static MockableRedisSubscriptionResource GetMockableRedisSubscriptionRes return resource.GetCachedClient(client => new MockableRedisSubscriptionResource(client, resource.Id)); } + private static MockableRedisTenantResource GetMockableRedisTenantResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableRedisTenantResource(client, resource.Id)); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -170,17 +175,17 @@ public static RedisCacheAccessPolicyAssignmentResource GetRedisCacheAccessPolicy /// Gets a collection of RedisResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. /// An object representing collection of RedisResources and their operations over a RedisResource. - public static RedisCollection GetAllRedis(this ResourceGroupResource resourceGroupResource) + public static RedisResourceCollection GetRedisResources(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableRedisResourceGroupResource(resourceGroupResource).GetAllRedis(); + return GetMockableRedisResourceGroupResource(resourceGroupResource).GetRedisResources(); } /// @@ -192,7 +197,7 @@ public static RedisCollection GetAllRedis(this ResourceGroupResource resourceGro /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -205,20 +210,20 @@ public static RedisCollection GetAllRedis(this ResourceGroupResource resourceGro /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the Redis cache. + /// The name of the RedisResource. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetRedisAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) + public static async Task> GetRedisResourceAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableRedisResourceGroupResource(resourceGroupResource).GetRedisAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableRedisResourceGroupResource(resourceGroupResource).GetRedisResourceAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -230,7 +235,7 @@ public static async Task> GetRedisAsync(this ResourceGro /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -243,32 +248,32 @@ public static async Task> GetRedisAsync(this ResourceGro /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the Redis cache. + /// The name of the RedisResource. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetRedis(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) + public static Response GetRedisResource(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableRedisResourceGroupResource(resourceGroupResource).GetRedis(name, cancellationToken); + return GetMockableRedisResourceGroupResource(resourceGroupResource).GetRedisResource(name, cancellationToken); } /// - /// Checks that the redis cache name is valid and is not already in use. + /// Gets all Redis caches in the specified subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis /// /// /// Operation Id - /// Redis_CheckNameAvailability + /// RedisResource_ListBySubscription /// /// /// Default Api Version @@ -281,30 +286,30 @@ public static Response GetRedis(this ResourceGroupResource resour /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Parameters supplied to the CheckNameAvailability Redis operation. The only supported resource type is 'Microsoft.Cache/redis'. /// The cancellation token to use. - /// or is null. - public static async Task CheckRedisNameAvailabilityAsync(this SubscriptionResource subscriptionResource, RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable ListBySubscriptionAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableRedisSubscriptionResource(subscriptionResource).CheckRedisNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); + return GetMockableRedisSubscriptionResource(subscriptionResource).ListBySubscriptionAsync(cancellationToken); } /// - /// Checks that the redis cache name is valid and is not already in use. + /// Gets all Redis caches in the specified subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/CheckNameAvailability + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis /// /// /// Operation Id - /// Redis_CheckNameAvailability + /// RedisResource_ListBySubscription /// /// /// Default Api Version @@ -317,90 +322,82 @@ public static async Task CheckRedisNameAvailabilityAsync(this Subscrip /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// Parameters supplied to the CheckNameAvailability Redis operation. The only supported resource type is 'Microsoft.Cache/redis'. /// The cancellation token to use. - /// or is null. - public static Response CheckRedisNameAvailability(this SubscriptionResource subscriptionResource, RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable ListBySubscription(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableRedisSubscriptionResource(subscriptionResource).CheckRedisNameAvailability(content, cancellationToken); + return GetMockableRedisSubscriptionResource(subscriptionResource).ListBySubscription(cancellationToken); } /// - /// Gets all Redis caches in the specified subscription. + /// Checks that the redis cache name is valid and is not already in use. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/checkNameAvailability /// /// /// Operation Id - /// Redis_ListBySubscription + /// RedisOperationGroup_CheckNameAvailability /// /// /// Default Api Version /// 2024-11-01 /// - /// - /// Resource - /// - /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. + /// The request body. /// The cancellation token to use. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetAllRedisAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// or is null. + public static async Task CheckNameAvailabilityAsync(this SubscriptionResource subscriptionResource, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableRedisSubscriptionResource(subscriptionResource).GetAllRedisAsync(cancellationToken); + return await GetMockableRedisSubscriptionResource(subscriptionResource).CheckNameAvailabilityAsync(content, cancellationToken).ConfigureAwait(false); } /// - /// Gets all Redis caches in the specified subscription. + /// Checks that the redis cache name is valid and is not already in use. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/redis + /// /subscriptions/{subscriptionId}/providers/Microsoft.Cache/checkNameAvailability /// /// /// Operation Id - /// Redis_ListBySubscription + /// RedisOperationGroup_CheckNameAvailability /// /// /// Default Api Version /// 2024-11-01 /// - /// - /// Resource - /// - /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. + /// The request body. /// The cancellation token to use. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetAllRedis(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// or is null. + public static Response CheckNameAvailability(this SubscriptionResource subscriptionResource, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableRedisSubscriptionResource(subscriptionResource).GetAllRedis(cancellationToken); + return GetMockableRedisSubscriptionResource(subscriptionResource).CheckNameAvailability(content, cancellationToken); } /// @@ -412,7 +409,7 @@ public static Pageable GetAllRedis(this SubscriptionResource subs /// /// /// Operation Id - /// AsyncOperationStatus_Get + /// AsyncOperationStatusOperationGroup_Get /// /// /// Default Api Version @@ -421,20 +418,20 @@ public static Pageable GetAllRedis(this SubscriptionResource subs /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The location at which operation was triggered. /// The ID of asynchronous operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public static async Task> GetAsyncOperationStatusAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string operationId, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public static async Task> GetAsync(this SubscriptionResource subscriptionResource, string location, string operationId, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableRedisSubscriptionResource(subscriptionResource).GetAsyncOperationStatusAsync(location, operationId, cancellationToken).ConfigureAwait(false); + return await GetMockableRedisSubscriptionResource(subscriptionResource).GetAsync(location, operationId, cancellationToken).ConfigureAwait(false); } /// @@ -446,7 +443,7 @@ public static async Task> GetAsyncOperationStatus /// /// /// Operation Id - /// AsyncOperationStatus_Get + /// AsyncOperationStatusOperationGroup_Get /// /// /// Default Api Version @@ -455,20 +452,84 @@ public static async Task> GetAsyncOperationStatus /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The location at which operation was triggered. /// The ID of asynchronous operation. /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// or is null. - public static Response GetAsyncOperationStatus(this SubscriptionResource subscriptionResource, AzureLocation location, string operationId, CancellationToken cancellationToken = default) + /// or is an empty string, and was expected to be non-empty. + /// , or is null. + public static Response Get(this SubscriptionResource subscriptionResource, string location, string operationId, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableRedisSubscriptionResource(subscriptionResource).GetAsyncOperationStatus(location, operationId, cancellationToken); + return GetMockableRedisSubscriptionResource(subscriptionResource).Get(location, operationId, cancellationToken); + } + + /// + /// List the operations for the provider + /// + /// + /// Request Path + /// /providers/Microsoft.Cache/operations + /// + /// + /// Operation Id + /// Operations_List + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable ListAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableRedisTenantResource(tenantResource).ListAsync(cancellationToken); + } + + /// + /// List the operations for the provider + /// + /// + /// Request Path + /// /providers/Microsoft.Cache/operations + /// + /// + /// Operation Id + /// Operations_List + /// + /// + /// Default Api Version + /// 2024-11-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable List(this TenantResource tenantResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableRedisTenantResource(tenantResource).List(cancellationToken); } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/BicepSerializationHelpers.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/BicepSerializationHelpers.cs deleted file mode 100644 index 29ab11b22d0d..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/BicepSerializationHelpers.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Text; - -namespace Azure.ResourceManager.Redis -{ - internal static class BicepSerializationHelpers - { - public static void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName) - { - string indent = new string(' ', spaces); - int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length; - int length = stringBuilder.Length; - bool inMultilineString = false; - - BinaryData data = ModelReaderWriter.Write(childObject, options, AzureResourceManagerRedisContext.Default); - string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); - for (int i = 0; i < lines.Length; i++) - { - string line = lines[i]; - if (inMultilineString) - { - if (line.Contains("'''")) - { - inMultilineString = false; - } - stringBuilder.AppendLine(line); - continue; - } - if (line.Contains("'''")) - { - inMultilineString = true; - stringBuilder.AppendLine($"{indent}{line}"); - continue; - } - if (i == 0 && !indentFirstLine) - { - stringBuilder.AppendLine($"{line}"); - } - else - { - stringBuilder.AppendLine($"{indent}{line}"); - } - } - if (stringBuilder.Length == length + emptyObjectLength) - { - stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length; - } - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/WirePathAttribute.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/WirePathAttribute.cs deleted file mode 100644 index fe4bde9c9166..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/WirePathAttribute.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Redis -{ - [AttributeUsage(AttributeTargets.Property)] - internal class WirePathAttribute : Attribute - { - private string _wirePath; - - public WirePathAttribute(string wirePath) - { - _wirePath = wirePath; - } - - public override string ToString() - { - return _wirePath; - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/OperationStatusResultOperationSource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/OperationStatusResultOperationSource.cs index ca0f8bbaf23f..e40fa43bbeed 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/OperationStatusResultOperationSource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/OperationStatusResultOperationSource.cs @@ -5,14 +5,11 @@ #nullable disable -using System; -using System.ClientModel.Primitives; -using System.Text; using System.Text.Json; using System.Threading; using System.Threading.Tasks; using Azure.Core; -using Azure.ResourceManager.Models; +using Azure.ResourceManager.Redis.Models; namespace Azure.ResourceManager.Redis { @@ -21,13 +18,13 @@ internal class OperationStatusResultOperationSource : IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - return ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(document.RootElement.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerRedisContext.Default); + return OperationStatusResult.DeserializeOperationStatusResult(document.RootElement); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - return ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(document.RootElement.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerRedisContext.Default); + return OperationStatusResult.DeserializeOperationStatusResult(document.RootElement); } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisOperationSource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisResourceOperationSource.cs similarity index 65% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisOperationSource.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisResourceOperationSource.cs index 6cdac40f9e50..33574c2ec9ac 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisOperationSource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisResourceOperationSource.cs @@ -12,24 +12,24 @@ namespace Azure.ResourceManager.Redis { - internal class RedisOperationSource : IOperationSource + internal class RedisResourceOperationSource : IOperationSource { private readonly ArmClient _client; - internal RedisOperationSource(ArmClient client) + internal RedisResourceOperationSource(ArmClient client) { _client = client; } RedisResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerRedisContext.Default); + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerRedisContext.Default); return new RedisResource(_client, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerRedisContext.Default); + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerRedisContext.Default); return await Task.FromResult(new RedisResource(_client, data)).ConfigureAwait(false); } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyAssignmentProvisioningState.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyAssignmentProvisioningState.cs index 77430c0eabd7..c1c0eabee4c2 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyAssignmentProvisioningState.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyAssignmentProvisioningState.cs @@ -29,17 +29,17 @@ public AccessPolicyAssignmentProvisioningState(string value) private const string CanceledValue = "Canceled"; private const string FailedValue = "Failed"; - /// Updating. + /// The access policy assignments are being updated *. public static AccessPolicyAssignmentProvisioningState Updating { get; } = new AccessPolicyAssignmentProvisioningState(UpdatingValue); - /// Succeeded. + /// The access policy assignments were successfully updated *. public static AccessPolicyAssignmentProvisioningState Succeeded { get; } = new AccessPolicyAssignmentProvisioningState(SucceededValue); - /// Deleting. + /// The access policy assignments are being deleted *. public static AccessPolicyAssignmentProvisioningState Deleting { get; } = new AccessPolicyAssignmentProvisioningState(DeletingValue); - /// Deleted. + /// The access policy assignments are considered deleted, meaning no custom access policies are applied. *. public static AccessPolicyAssignmentProvisioningState Deleted { get; } = new AccessPolicyAssignmentProvisioningState(DeletedValue); - /// Canceled. + /// The operation was canceled. Access policy assignments may be in a partially updated state. Update them again to have a well-defined state. *. public static AccessPolicyAssignmentProvisioningState Canceled { get; } = new AccessPolicyAssignmentProvisioningState(CanceledValue); - /// Failed. + /// The operation failed. Access policy assignments may be in a partially updated state. Update them again to have a well-defined state. *. 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); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyProvisioningState.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyProvisioningState.cs index 114c51dd509d..25173b162f36 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyProvisioningState.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyProvisioningState.cs @@ -29,17 +29,17 @@ public AccessPolicyProvisioningState(string value) private const string CanceledValue = "Canceled"; private const string FailedValue = "Failed"; - /// Updating. + /// An operation is in progress. *. public static AccessPolicyProvisioningState Updating { get; } = new AccessPolicyProvisioningState(UpdatingValue); - /// Succeeded. + /// The operation succeeded. *. public static AccessPolicyProvisioningState Succeeded { get; } = new AccessPolicyProvisioningState(SucceededValue); - /// Deleting. + /// A delete operation is in progress. *. public static AccessPolicyProvisioningState Deleting { get; } = new AccessPolicyProvisioningState(DeletingValue); - /// Deleted. + /// The access policy is considered deleted, if it still exists. *. public static AccessPolicyProvisioningState Deleted { get; } = new AccessPolicyProvisioningState(DeletedValue); - /// Canceled. + /// The operation was canceled. Access policies may be in a partially updated state. Update them again to have a well-defined state. *. public static AccessPolicyProvisioningState Canceled { get; } = new AccessPolicyProvisioningState(CanceledValue); - /// Failed. + /// The operation failed. Access policies may be in a partially updated state. Update them again to have a well-defined state. *. 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); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyType.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyType.cs index 0b7bef69c9d6..b215e3742dfe 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyType.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AccessPolicyType.cs @@ -25,9 +25,9 @@ public AccessPolicyType(string value) private const string CustomValue = "Custom"; private const string BuiltInValue = "BuiltIn"; - /// Custom. + /// User-configurable access policy, using the redis access policy authoring language *. public static AccessPolicyType Custom { get; } = new AccessPolicyType(CustomValue); - /// BuiltIn. + /// Built-in or well-known access policies, whose policy is not configurable. *. 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); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AzureResourceManagerRedisContext.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AzureResourceManagerRedisContext.cs index 3c0b978d7bfc..ff3566b30868 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AzureResourceManagerRedisContext.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AzureResourceManagerRedisContext.cs @@ -16,10 +16,16 @@ namespace Azure.ResourceManager.Redis /// Context class which will be filled in by the System.ClientModel.SourceGeneration. /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' /// - [ModelReaderWriterBuildable(typeof(ExportRdbContent))] - [ModelReaderWriterBuildable(typeof(ImportRdbContent))] + [ModelReaderWriterBuildable(typeof(CheckNameAvailabilityContent))] + [ModelReaderWriterBuildable(typeof(ExportRDBContent))] + [ModelReaderWriterBuildable(typeof(ImportRDBContent))] [ModelReaderWriterBuildable(typeof(ManagedServiceIdentity))] - [ModelReaderWriterBuildable(typeof(OperationStatusResult))] + [ModelReaderWriterBuildable(typeof(NotificationListResponse))] + [ModelReaderWriterBuildable(typeof(Models.Operation))] + [ModelReaderWriterBuildable(typeof(OperationDisplay))] + [ModelReaderWriterBuildable(typeof(OperationListResult))] + [ModelReaderWriterBuildable(typeof(OperationStatus))] + [ModelReaderWriterBuildable(typeof(Models.OperationStatusResult))] [ModelReaderWriterBuildable(typeof(RedisAccessKeys))] [ModelReaderWriterBuildable(typeof(RedisCacheAccessPolicyAssignmentData))] [ModelReaderWriterBuildable(typeof(RedisCacheAccessPolicyAssignmentList))] @@ -27,41 +33,38 @@ namespace Azure.ResourceManager.Redis [ModelReaderWriterBuildable(typeof(RedisCacheAccessPolicyData))] [ModelReaderWriterBuildable(typeof(RedisCacheAccessPolicyList))] [ModelReaderWriterBuildable(typeof(RedisCacheAccessPolicyResource))] - [ModelReaderWriterBuildable(typeof(RedisCommonConfiguration))] - [ModelReaderWriterBuildable(typeof(RedisCreateOrUpdateContent))] - [ModelReaderWriterBuildable(typeof(RedisData))] [ModelReaderWriterBuildable(typeof(RedisFirewallRuleData))] [ModelReaderWriterBuildable(typeof(RedisFirewallRuleListResult))] [ModelReaderWriterBuildable(typeof(RedisFirewallRuleResource))] - [ModelReaderWriterBuildable(typeof(RedisForceRebootResult))] + [ModelReaderWriterBuildable(typeof(RedisForceRebootResponse))] [ModelReaderWriterBuildable(typeof(RedisInstanceDetails))] [ModelReaderWriterBuildable(typeof(RedisLinkedServerWithPropertiesList))] [ModelReaderWriterBuildable(typeof(RedisLinkedServerWithPropertyCreateOrUpdateContent))] [ModelReaderWriterBuildable(typeof(RedisLinkedServerWithPropertyData))] [ModelReaderWriterBuildable(typeof(RedisLinkedServerWithPropertyResource))] [ModelReaderWriterBuildable(typeof(RedisListResult))] - [ModelReaderWriterBuildable(typeof(RedisNameAvailabilityContent))] - [ModelReaderWriterBuildable(typeof(RedisOperationStatus))] - [ModelReaderWriterBuildable(typeof(RedisPatch))] [ModelReaderWriterBuildable(typeof(RedisPatchScheduleData))] [ModelReaderWriterBuildable(typeof(RedisPatchScheduleListResult))] [ModelReaderWriterBuildable(typeof(RedisPatchScheduleResource))] - [ModelReaderWriterBuildable(typeof(RedisPatchScheduleSetting))] [ModelReaderWriterBuildable(typeof(RedisPrivateEndpointConnectionData))] [ModelReaderWriterBuildable(typeof(RedisPrivateEndpointConnectionListResult))] [ModelReaderWriterBuildable(typeof(RedisPrivateEndpointConnectionResource))] - [ModelReaderWriterBuildable(typeof(RedisPrivateLinkResource))] + [ModelReaderWriterBuildable(typeof(RedisPrivateLinkResourceData))] [ModelReaderWriterBuildable(typeof(RedisPrivateLinkResourceListResult))] + [ModelReaderWriterBuildable(typeof(RedisPrivateLinkResourceProperties))] [ModelReaderWriterBuildable(typeof(RedisPrivateLinkServiceConnectionState))] [ModelReaderWriterBuildable(typeof(RedisRebootContent))] [ModelReaderWriterBuildable(typeof(RedisRegenerateKeyContent))] [ModelReaderWriterBuildable(typeof(RedisResource))] + [ModelReaderWriterBuildable(typeof(RedisResourceCreateOrUpdateContent))] + [ModelReaderWriterBuildable(typeof(RedisResourceData))] + [ModelReaderWriterBuildable(typeof(RedisResourcePatch))] [ModelReaderWriterBuildable(typeof(RedisSku))] - [ModelReaderWriterBuildable(typeof(RedisUpgradeNotification))] - [ModelReaderWriterBuildable(typeof(RedisUpgradeNotificationListResponse))] [ModelReaderWriterBuildable(typeof(ResponseError))] + [ModelReaderWriterBuildable(typeof(ScheduleEntry))] [ModelReaderWriterBuildable(typeof(SubResource))] [ModelReaderWriterBuildable(typeof(SystemData))] + [ModelReaderWriterBuildable(typeof(UpgradeNotification))] [ModelReaderWriterBuildable(typeof(UserAssignedIdentity))] public partial class AzureResourceManagerRedisContext : ModelReaderWriterContext { diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/CheckNameAvailabilityContent.Serialization.cs similarity index 73% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.Serialization.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/CheckNameAvailabilityContent.Serialization.cs index a23b6c61dd7a..213a782ee9fa 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/CheckNameAvailabilityContent.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Redis.Models { - public partial class RedisNameAvailabilityContent : IUtf8JsonSerializable, IJsonModel + public partial class CheckNameAvailabilityContent : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,16 +28,16 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(RedisNameAvailabilityContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(CheckNameAvailabilityContent)} does not support writing '{format}' format."); } writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); + writer.WriteStringValue(Type); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -55,19 +55,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - RedisNameAvailabilityContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + CheckNameAvailabilityContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(RedisNameAvailabilityContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(CheckNameAvailabilityContent)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisNameAvailabilityContent(document.RootElement, options); + return DeserializeCheckNameAvailabilityContent(document.RootElement, options); } - internal static RedisNameAvailabilityContent DeserializeRedisNameAvailabilityContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static CheckNameAvailabilityContent DeserializeCheckNameAvailabilityContent(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -76,7 +76,7 @@ internal static RedisNameAvailabilityContent DeserializeRedisNameAvailabilityCon return null; } string name = default; - ResourceType type = default; + string type = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -88,7 +88,7 @@ internal static RedisNameAvailabilityContent DeserializeRedisNameAvailabilityCon } if (property.NameEquals("type"u8)) { - type = new ResourceType(property.Value.GetString()); + type = property.Value.GetString(); continue; } if (options.Format != "W") @@ -97,38 +97,38 @@ internal static RedisNameAvailabilityContent DeserializeRedisNameAvailabilityCon } } serializedAdditionalRawData = rawDataDictionary; - return new RedisNameAvailabilityContent(name, type, serializedAdditionalRawData); + return new CheckNameAvailabilityContent(name, type, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); default: - throw new FormatException($"The model {nameof(RedisNameAvailabilityContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(CheckNameAvailabilityContent)} does not support writing '{options.Format}' format."); } } - RedisNameAvailabilityContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + CheckNameAvailabilityContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisNameAvailabilityContent(document.RootElement, options); + return DeserializeCheckNameAvailabilityContent(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(RedisNameAvailabilityContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(CheckNameAvailabilityContent)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/CheckNameAvailabilityContent.cs similarity index 66% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/CheckNameAvailabilityContent.cs index 3027a70be63a..29838bee9f73 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/CheckNameAvailabilityContent.cs @@ -7,12 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.Redis.Models { /// Parameters body to pass for resource name availability check. - public partial class RedisNameAvailabilityContent + public partial class CheckNameAvailabilityContent { /// /// Keeps track of any properties unknown to the library. @@ -46,39 +45,38 @@ public partial class RedisNameAvailabilityContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Resource name. - /// Resource type. The only legal value of this property for checking redis cache name availability is 'Microsoft.Cache/redis'. - /// is null. - public RedisNameAvailabilityContent(string name, ResourceType resourceType) + /// Resource type. The only legal value of this property for checking redis cache name availability is 'Microsoft.Cache/redis'. + /// or is null. + public CheckNameAvailabilityContent(string name, string type) { Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(type, nameof(type)); Name = name; - ResourceType = resourceType; + Type = type; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Resource name. - /// Resource type. The only legal value of this property for checking redis cache name availability is 'Microsoft.Cache/redis'. + /// Resource type. The only legal value of this property for checking redis cache name availability is 'Microsoft.Cache/redis'. /// Keeps track of any properties unknown to the library. - internal RedisNameAvailabilityContent(string name, ResourceType resourceType, IDictionary serializedAdditionalRawData) + internal CheckNameAvailabilityContent(string name, string type, IDictionary serializedAdditionalRawData) { Name = name; - ResourceType = resourceType; + Type = type; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal RedisNameAvailabilityContent() + /// Initializes a new instance of for deserialization. + internal CheckNameAvailabilityContent() { } /// Resource name. - [WirePath("name")] public string Name { get; } /// Resource type. The only legal value of this property for checking redis cache name availability is 'Microsoft.Cache/redis'. - [WirePath("type")] - public ResourceType ResourceType { get; } + public string Type { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DayOfWeek.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DayOfWeek.Serialization.cs new file mode 100644 index 000000000000..322746124ec7 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DayOfWeek.Serialization.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Redis.Models +{ + internal static partial class DayOfWeekExtensions + { + public static string ToSerialString(this DayOfWeek value) => value switch + { + DayOfWeek.Monday => "Monday", + DayOfWeek.Tuesday => "Tuesday", + DayOfWeek.Wednesday => "Wednesday", + DayOfWeek.Thursday => "Thursday", + DayOfWeek.Friday => "Friday", + DayOfWeek.Saturday => "Saturday", + DayOfWeek.Sunday => "Sunday", + DayOfWeek.Everyday => "Everyday", + DayOfWeek.Weekend => "Weekend", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DayOfWeek value.") + }; + + public static DayOfWeek ToDayOfWeek(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Monday")) return DayOfWeek.Monday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Tuesday")) return DayOfWeek.Tuesday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Wednesday")) return DayOfWeek.Wednesday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Thursday")) return DayOfWeek.Thursday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Friday")) return DayOfWeek.Friday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Saturday")) return DayOfWeek.Saturday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Sunday")) return DayOfWeek.Sunday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Everyday")) return DayOfWeek.Everyday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Weekend")) return DayOfWeek.Weekend; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DayOfWeek value."); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisDayOfWeek.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DayOfWeek.cs similarity index 70% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisDayOfWeek.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DayOfWeek.cs index 17d5e763585e..aaaed604b6d7 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisDayOfWeek.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DayOfWeek.cs @@ -8,7 +8,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Day of the week when a cache can be patched. - public enum RedisDayOfWeek + public enum DayOfWeek { /// Monday. Monday, @@ -24,9 +24,9 @@ public enum RedisDayOfWeek Saturday, /// Sunday. Sunday, - /// Everyday. + /// As a convenience, 'Everyday' is also accepted and means the same as specifying all days of the week. *. Everyday, - /// Weekend. + /// As a conveneince, 'Weekend' is also accepted and means the same as specifying Saturday and Sunday. *. Weekend } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DefaultName.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DefaultName.cs new file mode 100644 index 000000000000..f58acf3ce37c --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DefaultName.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Redis.Models +{ + /// The name of the resource that is the target of a particular operation. For singleton resources, it must be 'Default'. + public readonly partial struct DefaultName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DefaultName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "default"; + + /// The name of e.g. the patch schedules resource, which is a singleton, must always be 'Default' *. + public static DefaultName Default { get; } = new DefaultName(DefaultValue); + /// Determines if two values are the same. + public static bool operator ==(DefaultName left, DefaultName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DefaultName left, DefaultName right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DefaultName(string value) => new DefaultName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DefaultName other && Equals(other); + /// + public bool Equals(DefaultName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.Serialization.cs index 3a2f9301afed..0ae85be9fa71 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Redis.Models { - public partial class ExportRdbContent : IUtf8JsonSerializable, IJsonModel + public partial class ExportRDBContent : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ExportRdbContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ExportRDBContent)} does not support writing '{format}' format."); } if (Optional.IsDefined(Format)) @@ -70,19 +70,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ExportRdbContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ExportRDBContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ExportRdbContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ExportRDBContent)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeExportRdbContent(document.RootElement, options); + return DeserializeExportRDBContent(document.RootElement, options); } - internal static ExportRdbContent DeserializeExportRdbContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static ExportRDBContent DeserializeExportRDBContent(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -130,7 +130,7 @@ internal static ExportRdbContent DeserializeExportRdbContent(JsonElement element } } serializedAdditionalRawData = rawDataDictionary; - return new ExportRdbContent( + return new ExportRDBContent( format, prefix, container, @@ -139,35 +139,35 @@ internal static ExportRdbContent DeserializeExportRdbContent(JsonElement element serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); default: - throw new FormatException($"The model {nameof(ExportRdbContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ExportRDBContent)} does not support writing '{options.Format}' format."); } } - ExportRdbContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ExportRDBContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeExportRdbContent(document.RootElement, options); + return DeserializeExportRDBContent(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ExportRdbContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ExportRDBContent)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.cs index ee72935033bc..c00302535dae 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Parameters for Redis export operation. - public partial class ExportRdbContent + public partial class ExportRDBContent { /// /// Keeps track of any properties unknown to the library. @@ -45,11 +45,11 @@ public partial class ExportRdbContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Prefix to use for exported files. /// Container name to export to. /// or is null. - public ExportRdbContent(string prefix, string container) + public ExportRDBContent(string prefix, string container) { Argument.AssertNotNull(prefix, nameof(prefix)); Argument.AssertNotNull(container, nameof(container)); @@ -58,14 +58,14 @@ public ExportRdbContent(string prefix, string container) Container = container; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// File format. /// Prefix to use for exported files. /// Container name to export to. /// Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. /// Subscription id of the storage container for data to be exported using ManagedIdentity. /// Keeps track of any properties unknown to the library. - internal ExportRdbContent(string format, string prefix, string container, string preferredDataArchiveAuthMethod, string storageSubscriptionId, IDictionary serializedAdditionalRawData) + internal ExportRDBContent(string format, string prefix, string container, string preferredDataArchiveAuthMethod, string storageSubscriptionId, IDictionary serializedAdditionalRawData) { Format = format; Prefix = prefix; @@ -75,25 +75,20 @@ internal ExportRdbContent(string format, string prefix, string container, string _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ExportRdbContent() + /// Initializes a new instance of for deserialization. + internal ExportRDBContent() { } /// File format. - [WirePath("format")] public string Format { get; set; } /// Prefix to use for exported files. - [WirePath("prefix")] public string Prefix { get; } /// Container name to export to. - [WirePath("container")] public string Container { get; } /// Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. - [WirePath("preferred-data-archive-auth-method")] public string PreferredDataArchiveAuthMethod { get; set; } /// Subscription id of the storage container for data to be exported using ManagedIdentity. - [WirePath("storage-subscription-id")] public string StorageSubscriptionId { get; set; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.Serialization.cs index 546039fa964b..4f0243b326ee 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Redis.Models { - public partial class ImportRdbContent : IUtf8JsonSerializable, IJsonModel + public partial class ImportRDBContent : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ImportRdbContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ImportRDBContent)} does not support writing '{format}' format."); } if (Optional.IsDefined(Format)) @@ -73,19 +73,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ImportRdbContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ImportRDBContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ImportRdbContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ImportRDBContent)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeImportRdbContent(document.RootElement, options); + return DeserializeImportRDBContent(document.RootElement, options); } - internal static ImportRdbContent DeserializeImportRdbContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static ImportRDBContent DeserializeImportRDBContent(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -132,38 +132,38 @@ internal static ImportRdbContent DeserializeImportRdbContent(JsonElement element } } serializedAdditionalRawData = rawDataDictionary; - return new ImportRdbContent(format, files, preferredDataArchiveAuthMethod, storageSubscriptionId, serializedAdditionalRawData); + return new ImportRDBContent(format, files, preferredDataArchiveAuthMethod, storageSubscriptionId, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); default: - throw new FormatException($"The model {nameof(ImportRdbContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ImportRDBContent)} does not support writing '{options.Format}' format."); } } - ImportRdbContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ImportRDBContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeImportRdbContent(document.RootElement, options); + return DeserializeImportRDBContent(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ImportRdbContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ImportRDBContent)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.cs index 2bd61983c0e1..3da4453a42df 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Parameters for Redis import operation. - public partial class ImportRdbContent + public partial class ImportRDBContent { /// /// Keeps track of any properties unknown to the library. @@ -46,23 +46,23 @@ public partial class ImportRdbContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// files to import. /// is null. - public ImportRdbContent(IEnumerable files) + public ImportRDBContent(IEnumerable files) { Argument.AssertNotNull(files, nameof(files)); Files = files.ToList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// File format. /// files to import. /// Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. /// Subscription id of the storage container containing files to import using Managed Identity. /// Keeps track of any properties unknown to the library. - internal ImportRdbContent(string format, IList files, string preferredDataArchiveAuthMethod, string storageSubscriptionId, IDictionary serializedAdditionalRawData) + internal ImportRDBContent(string format, IList files, string preferredDataArchiveAuthMethod, string storageSubscriptionId, IDictionary serializedAdditionalRawData) { Format = format; Files = files; @@ -71,22 +71,18 @@ internal ImportRdbContent(string format, IList files, string preferredDa _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ImportRdbContent() + /// Initializes a new instance of for deserialization. + internal ImportRDBContent() { } /// File format. - [WirePath("format")] public string Format { get; set; } /// files to import. - [WirePath("files")] public IList Files { get; } /// Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. - [WirePath("preferred-data-archive-auth-method")] public string PreferredDataArchiveAuthMethod { get; set; } /// Subscription id of the storage container containing files to import using Managed Identity. - [WirePath("storage-subscription-id")] public string StorageSubscriptionId { get; set; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/NotificationListResponse.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/NotificationListResponse.Serialization.cs new file mode 100644 index 000000000000..3cb716d54086 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/NotificationListResponse.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Redis.Models +{ + internal partial class NotificationListResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NotificationListResponse)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + NotificationListResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(NotificationListResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeNotificationListResponse(document.RootElement, options); + } + + internal static NotificationListResponse DeserializeNotificationListResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(UpgradeNotification.DeserializeUpgradeNotification(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new NotificationListResponse(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + default: + throw new FormatException($"The model {nameof(NotificationListResponse)} does not support writing '{options.Format}' format."); + } + } + + NotificationListResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeNotificationListResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(NotificationListResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/NotificationListResponse.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/NotificationListResponse.cs new file mode 100644 index 000000000000..c8ba9740c58e --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/NotificationListResponse.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Redis.Models +{ + /// The response of listUpgradeNotifications. + internal partial class NotificationListResponse + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The UpgradeNotification items on this page. + /// is null. + internal NotificationListResponse(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The UpgradeNotification items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal NotificationListResponse(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NotificationListResponse() + { + } + + /// The UpgradeNotification items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.Serialization.cs new file mode 100644 index 000000000000..f724f4554002 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Redis.Models +{ + public partial class Operation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Operation)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Display)) + { + writer.WritePropertyName("display"u8); + writer.WriteObjectValue(Display, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Operation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Operation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperation(document.RootElement, options); + } + + internal static Operation DeserializeOperation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + OperationDisplay display = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("display"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + display = OperationDisplay.DeserializeOperationDisplay(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Operation(name, display, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + default: + throw new FormatException($"The model {nameof(Operation)} does not support writing '{options.Format}' format."); + } + } + + Operation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOperation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Operation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.cs new file mode 100644 index 000000000000..0e19501b0bb3 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Redis.Models +{ + /// REST API operation. + public partial class Operation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal Operation() + { + } + + /// Initializes a new instance of . + /// Operation name: {provider}/{resource}/{operation}. + /// The object that describes the operation. + /// Keeps track of any properties unknown to the library. + internal Operation(string name, OperationDisplay display, IDictionary serializedAdditionalRawData) + { + Name = name; + Display = display; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Operation name: {provider}/{resource}/{operation}. + public string Name { get; } + /// The object that describes the operation. + public OperationDisplay Display { get; } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.Serialization.cs new file mode 100644 index 000000000000..52f609d2dffd --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.Serialization.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Redis.Models +{ + public partial class OperationDisplay : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationDisplay)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Provider)) + { + writer.WritePropertyName("provider"u8); + writer.WriteStringValue(Provider); + } + if (Optional.IsDefined(Operation)) + { + writer.WritePropertyName("operation"u8); + writer.WriteStringValue(Operation); + } + if (Optional.IsDefined(Resource)) + { + writer.WritePropertyName("resource"u8); + writer.WriteStringValue(Resource); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OperationDisplay IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationDisplay)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperationDisplay(document.RootElement, options); + } + + internal static OperationDisplay DeserializeOperationDisplay(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string provider = default; + string operation = default; + string resource = default; + string description = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provider"u8)) + { + provider = property.Value.GetString(); + continue; + } + if (property.NameEquals("operation"u8)) + { + operation = property.Value.GetString(); + continue; + } + if (property.NameEquals("resource"u8)) + { + resource = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OperationDisplay(provider, operation, resource, description, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + default: + throw new FormatException($"The model {nameof(OperationDisplay)} does not support writing '{options.Format}' format."); + } + } + + OperationDisplay IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOperationDisplay(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OperationDisplay)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.cs new file mode 100644 index 000000000000..8df1fcaff56c --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Redis.Models +{ + /// The object that describes the operation. + public partial class OperationDisplay + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal OperationDisplay() + { + } + + /// Initializes a new instance of . + /// Friendly name of the resource provider. + /// Operation type: read, write, delete, listKeys/action, etc. + /// Resource type on which the operation is performed. + /// Friendly name of the operation. + /// Keeps track of any properties unknown to the library. + internal OperationDisplay(string provider, string operation, string resource, string description, IDictionary serializedAdditionalRawData) + { + Provider = provider; + Operation = operation; + Resource = resource; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Friendly name of the resource provider. + public string Provider { get; } + /// Operation type: read, write, delete, listKeys/action, etc. + public string Operation { get; } + /// Resource type on which the operation is performed. + public string Resource { get; } + /// Friendly name of the operation. + public string Description { get; } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.Serialization.cs new file mode 100644 index 000000000000..65e9aa65d266 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Redis.Models +{ + internal partial class OperationListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OperationListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperationListResult(document.RootElement, options); + } + + internal static OperationListResult DeserializeOperationListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Operation.DeserializeOperation(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OperationListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + default: + throw new FormatException($"The model {nameof(OperationListResult)} does not support writing '{options.Format}' format."); + } + } + + OperationListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOperationListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OperationListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.cs new file mode 100644 index 000000000000..6d06c5579ef4 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Redis.Models +{ + /// Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. + internal partial class OperationListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// List of operations supported by the resource provider. + /// is null. + internal OperationListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// List of operations supported by the resource provider. + /// URL to get the next set of operation list results if there are any. + /// Keeps track of any properties unknown to the library. + internal OperationListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OperationListResult() + { + } + + /// List of operations supported by the resource provider. + public IReadOnlyList Value { get; } + /// URL to get the next set of operation list results if there are any. + public string NextLink { get; } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatus.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatus.Serialization.cs new file mode 100644 index 000000000000..f910424aac44 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatus.Serialization.cs @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Redis.Models +{ + public partial class OperationStatus : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationStatus)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + foreach (var item in Properties) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + writer.WriteEndObject(); + } + } + + OperationStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationStatus)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperationStatus(document.RootElement, options); + } + + internal static OperationStatus DeserializeOperationStatus(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyDictionary properties = default; + string id = default; + string name = default; + string status = default; + double? percentComplete = default; + DateTimeOffset? startTime = default; + DateTimeOffset? endTime = default; + IReadOnlyList operations = default; + ResponseError error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); + } + } + properties = dictionary; + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("percentComplete"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + percentComplete = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("operations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeOperationStatusResult(item, options)); + } + operations = array; + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), options, AzureResourceManagerRedisContext.Default); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OperationStatus( + id, + name, + status, + percentComplete, + startTime, + endTime, + operations ?? new ChangeTrackingList(), + error, + serializedAdditionalRawData, + properties ?? new ChangeTrackingDictionary()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + default: + throw new FormatException($"The model {nameof(OperationStatus)} does not support writing '{options.Format}' format."); + } + } + + OperationStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOperationStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OperationStatus)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatus.cs similarity index 53% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatus.cs index b35226cdb889..0a71b9e3b98f 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatus.cs @@ -7,54 +7,23 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Redis.Models { /// Asynchronous operation status. - public partial class RedisOperationStatus : OperationStatusResult + public partial class OperationStatus : OperationStatusResult { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . + /// Initializes a new instance of . /// Operation status. - internal RedisOperationStatus(string status) : base(status) + /// is null. + internal OperationStatus(string status) : base(status) { + Argument.AssertNotNull(status, nameof(status)); + Properties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Fully qualified ID for the async operation. /// Name of the async operation. /// Operation status. @@ -63,16 +32,15 @@ internal RedisOperationStatus(string status) : base(status) /// The end time of the operation. /// The operations list. /// If present, details of the operation error. - /// Additional properties from RP, only when operation is successful. /// Keeps track of any properties unknown to the library. - internal RedisOperationStatus(ResourceIdentifier id, string name, string status, float? percentComplete, DateTimeOffset? startOn, DateTimeOffset? endOn, IReadOnlyList operations, ResponseError error, IReadOnlyDictionary properties, IDictionary serializedAdditionalRawData) : base(id, name, status, percentComplete, startOn, endOn, operations, error) + /// Additional properties from RP, only when operation is successful. + internal OperationStatus(string id, string name, string status, double? percentComplete, DateTimeOffset? startOn, DateTimeOffset? endOn, IReadOnlyList operations, ResponseError error, IDictionary serializedAdditionalRawData, IReadOnlyDictionary properties) : base(id, name, status, percentComplete, startOn, endOn, operations, error, serializedAdditionalRawData) { Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal RedisOperationStatus() + /// Initializes a new instance of for deserialization. + internal OperationStatus() { } @@ -106,7 +74,6 @@ internal RedisOperationStatus() /// /// /// - [WirePath("properties")] public IReadOnlyDictionary Properties { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.Serialization.cs new file mode 100644 index 000000000000..f130e4ea67da --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.Serialization.cs @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Redis.Models +{ + public partial class OperationStatusResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationStatusResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + if (Optional.IsDefined(PercentComplete)) + { + writer.WritePropertyName("percentComplete"u8); + writer.WriteNumberValue(PercentComplete.Value); + } + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (Optional.IsCollectionDefined(Operations)) + { + writer.WritePropertyName("operations"u8); + writer.WriteStartArray(); + foreach (var item in Operations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + ((IJsonModel)Error).Write(writer, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OperationStatusResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OperationStatusResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOperationStatusResult(document.RootElement, options); + } + + internal static OperationStatusResult DeserializeOperationStatusResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string name = default; + string status = default; + double? percentComplete = default; + DateTimeOffset? startTime = default; + DateTimeOffset? endTime = default; + IReadOnlyList operations = default; + ResponseError error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("percentComplete"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + percentComplete = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("operations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeOperationStatusResult(item, options)); + } + operations = array; + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), options, AzureResourceManagerRedisContext.Default); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OperationStatusResult( + id, + name, + status, + percentComplete, + startTime, + endTime, + operations ?? new ChangeTrackingList(), + error, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + default: + throw new FormatException($"The model {nameof(OperationStatusResult)} does not support writing '{options.Format}' format."); + } + } + + OperationStatusResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOperationStatusResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OperationStatusResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.cs new file mode 100644 index 000000000000..92a63f87d3c3 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Redis.Models +{ + /// The current status of an async operation. + public partial class OperationStatusResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Operation status. + /// is null. + internal OperationStatusResult(string status) + { + Argument.AssertNotNull(status, nameof(status)); + + Status = status; + Operations = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Fully qualified ID for the async operation. + /// Name of the async operation. + /// Operation status. + /// Percent of the operation that is complete. + /// The start time of the operation. + /// The end time of the operation. + /// The operations list. + /// If present, details of the operation error. + /// Keeps track of any properties unknown to the library. + internal OperationStatusResult(string id, string name, string status, double? percentComplete, DateTimeOffset? startOn, DateTimeOffset? endOn, IReadOnlyList operations, ResponseError error, IDictionary serializedAdditionalRawData) + { + Id = id; + Name = name; + Status = status; + PercentComplete = percentComplete; + StartOn = startOn; + EndOn = endOn; + Operations = operations; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OperationStatusResult() + { + } + + /// Fully qualified ID for the async operation. + public string Id { get; } + /// Name of the async operation. + public string Name { get; } + /// Operation status. + public string Status { get; } + /// Percent of the operation that is complete. + public double? PercentComplete { get; } + /// The start time of the operation. + public DateTimeOffset? StartOn { get; } + /// The end time of the operation. + public DateTimeOffset? EndOn { get; } + /// The operations list. + public IReadOnlyList Operations { get; } + /// If present, details of the operation error. + public ResponseError Error { get; } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ProvisioningState.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..80e1f2efa819 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Redis.Models +{ + /// Redis instance provisioning status. + public readonly partial struct ProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatingValue = "Creating"; + private const string DeletingValue = "Deleting"; + private const string DisabledValue = "Disabled"; + private const string FailedValue = "Failed"; + private const string LinkingValue = "Linking"; + private const string ProvisioningValue = "Provisioning"; + private const string RecoveringScaleFailureValue = "RecoveringScaleFailure"; + private const string ScalingValue = "Scaling"; + private const string SucceededValue = "Succeeded"; + private const string UnlinkingValue = "Unlinking"; + private const string UnprovisioningValue = "Unprovisioning"; + private const string UpdatingValue = "Updating"; + private const string ConfiguringAADValue = "ConfiguringAAD"; + + /// A create operation is in progress. *. + public static ProvisioningState Creating { get; } = new ProvisioningState(CreatingValue); + /// A delete operation is in progress. *. + public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue); + /// The cache is disabled and cannot be used. *. + public static ProvisioningState Disabled { get; } = new ProvisioningState(DisabledValue); + /// An operation such as create or update failed. If you failed to create the cache it will not be in a usable state, so you should delete and recreate it. *. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Georeplication link is in progress *. + public static ProvisioningState Linking { get; } = new ProvisioningState(LinkingValue); + /// An operation is in progress *. + public static ProvisioningState Provisioning { get; } = new ProvisioningState(ProvisioningValue); + /// A scaling operation encountered an error and recovery is in progress. *. + public static ProvisioningState RecoveringScaleFailure { get; } = new ProvisioningState(RecoveringScaleFailureValue); + /// A scaling operation is in progress *. + public static ProvisioningState Scaling { get; } = new ProvisioningState(ScalingValue); + /// The most recent operation successfully completed *. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Georeplication unlink is in progress *. + public static ProvisioningState Unlinking { get; } = new ProvisioningState(UnlinkingValue); + /// The cache may be being disabled *. + public static ProvisioningState Unprovisioning { get; } = new ProvisioningState(UnprovisioningValue); + /// An update operation is in progress. *. + public static ProvisioningState Updating { get; } = new ProvisioningState(UpdatingValue); + /// An AAD configuration update operation is in progress. *. + public static ProvisioningState ConfiguringAAD { get; } = new ProvisioningState(ConfiguringAADValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + /// + public bool Equals(ProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RebootType.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RebootType.cs new file mode 100644 index 000000000000..2cbab95c9f8c --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RebootType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Redis.Models +{ + /// Which Redis node(s) to reboot. Depending on this value data loss is possible. + public readonly partial struct RebootType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RebootType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PrimaryNodeValue = "PrimaryNode"; + private const string SecondaryNodeValue = "SecondaryNode"; + private const string AllNodesValue = "AllNodes"; + + /// Reboot the primary nodes used for redis write operations. (This may trigger role changes.) *. + public static RebootType PrimaryNode { get; } = new RebootType(PrimaryNodeValue); + /// Reboot only the secondary or replica nodes *. + public static RebootType SecondaryNode { get; } = new RebootType(SecondaryNodeValue); + /// Reboot all nodes, not guaranteed to happen simultaneously. *. + public static RebootType AllNodes { get; } = new RebootType(AllNodesValue); + /// Determines if two values are the same. + public static bool operator ==(RebootType left, RebootType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RebootType left, RebootType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RebootType(string value) => new RebootType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RebootType other && Equals(other); + /// + public bool Equals(RebootType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.Serialization.cs index 0c96a3c7a1cc..6ec6d0af355c 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.Serialization.cs @@ -8,7 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; using Azure.Core; @@ -107,67 +106,6 @@ internal static RedisAccessKeys DeserializeRedisAccessKeys(JsonElement element, return new RedisAccessKeys(primaryKey, secondaryKey, serializedAdditionalRawData); } - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrimaryKey), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" primaryKey: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PrimaryKey)) - { - builder.Append(" primaryKey: "); - if (PrimaryKey.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{PrimaryKey}'''"); - } - else - { - builder.AppendLine($"'{PrimaryKey}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecondaryKey), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" secondaryKey: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SecondaryKey)) - { - builder.Append(" secondaryKey: "); - if (SecondaryKey.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{SecondaryKey}'''"); - } - else - { - builder.AppendLine($"'{SecondaryKey}'"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -176,8 +114,6 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opt { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisAccessKeys)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.cs index 71bef85e8a40..bda21d3d2fa3 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.cs @@ -62,10 +62,8 @@ internal RedisAccessKeys(string primaryKey, string secondaryKey, IDictionary The current primary key that clients can use to authenticate with Redis cache. - [WirePath("primaryKey")] public string PrimaryKey { get; } /// The current secondary key that clients can use to authenticate with Redis cache. - [WirePath("secondaryKey")] public string SecondaryKey { get; } } } 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 index 77a4dc06c28b..bd67ffbac99d 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.Serialization.cs @@ -8,8 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; using Azure.Core; @@ -36,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(RedisCacheAccessPolicyAssignmentList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +84,13 @@ internal static RedisCacheAccessPolicyAssignmentList DeserializeRedisCacheAccess return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); 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()) { @@ -110,7 +101,11 @@ internal static RedisCacheAccessPolicyAssignmentList DeserializeRedisCacheAccess } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,68 +114,7 @@ internal static RedisCacheAccessPolicyAssignmentList DeserializeRedisCacheAccess } } serializedAdditionalRawData = rawDataDictionary; - return new RedisCacheAccessPolicyAssignmentList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); + return new RedisCacheAccessPolicyAssignmentList(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) @@ -191,8 +125,6 @@ BinaryData IPersistableModel.Write(ModelRe { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisCacheAccessPolicyAssignmentList)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.cs index ef2d1c920d9f..4e30c9d41301 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Redis.Models { @@ -46,25 +47,34 @@ internal partial class RedisCacheAccessPolicyAssignmentList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal RedisCacheAccessPolicyAssignmentList() + /// The RedisCacheAccessPolicyAssignment items on this page. + /// is null. + internal RedisCacheAccessPolicyAssignmentList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of access policies assignments (with properties) of a Redis cache. - /// Link for next set. + /// The RedisCacheAccessPolicyAssignment items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal RedisCacheAccessPolicyAssignmentList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal RedisCacheAccessPolicyAssignmentList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of access policies assignments (with properties) of a Redis cache. + /// Initializes a new instance of for deserialization. + internal RedisCacheAccessPolicyAssignmentList() + { + } + + /// The RedisCacheAccessPolicyAssignment items on this page. public IReadOnlyList Value { get; } - /// Link for next set. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } 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 index 19ef7f661fd3..154682b8ce7e 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.Serialization.cs @@ -8,8 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; using Azure.Core; @@ -36,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(RedisCacheAccessPolicyList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +84,13 @@ internal static RedisCacheAccessPolicyList DeserializeRedisCacheAccessPolicyList return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); 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()) { @@ -110,7 +101,11 @@ internal static RedisCacheAccessPolicyList DeserializeRedisCacheAccessPolicyList } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,68 +114,7 @@ internal static RedisCacheAccessPolicyList DeserializeRedisCacheAccessPolicyList } } serializedAdditionalRawData = rawDataDictionary; - return new RedisCacheAccessPolicyList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); + return new RedisCacheAccessPolicyList(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) @@ -191,8 +125,6 @@ BinaryData IPersistableModel.Write(ModelReaderWriter { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisCacheAccessPolicyList)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.cs index 6341990fb644..01927a739717 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Redis.Models { @@ -46,25 +47,34 @@ internal partial class RedisCacheAccessPolicyList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal RedisCacheAccessPolicyList() + /// The RedisCacheAccessPolicy items on this page. + /// is null. + internal RedisCacheAccessPolicyList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of access policies (with properties) of a Redis cache. - /// Link for next set. + /// The RedisCacheAccessPolicy items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal RedisCacheAccessPolicyList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal RedisCacheAccessPolicyList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of access policies (with properties) of a Redis cache. + /// Initializes a new instance of for deserialization. + internal RedisCacheAccessPolicyList() + { + } + + /// The RedisCacheAccessPolicy items on this page. public IReadOnlyList Value { get; } - /// Link for next set. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.Serialization.cs deleted file mode 100644 index 09cc0afa6a2a..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.Serialization.cs +++ /dev/null @@ -1,774 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Redis.Models -{ - public partial class RedisCommonConfiguration : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisCommonConfiguration)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IsRdbBackupEnabled)) - { - writer.WritePropertyName("rdb-backup-enabled"u8); - writer.WriteBooleanValue(IsRdbBackupEnabled.Value); - } - if (Optional.IsDefined(RdbBackupFrequency)) - { - writer.WritePropertyName("rdb-backup-frequency"u8); - writer.WriteStringValue(RdbBackupFrequency); - } - if (Optional.IsDefined(RdbBackupMaxSnapshotCount)) - { - writer.WritePropertyName("rdb-backup-max-snapshot-count"u8); - WriteRdbBackupMaxSnapshotCount(writer, options); - } - if (Optional.IsDefined(RdbStorageConnectionString)) - { - writer.WritePropertyName("rdb-storage-connection-string"u8); - writer.WriteStringValue(RdbStorageConnectionString); - } - if (Optional.IsDefined(IsAofBackupEnabled)) - { - writer.WritePropertyName("aof-backup-enabled"u8); - writer.WriteBooleanValue(IsAofBackupEnabled.Value); - } - if (Optional.IsDefined(AofStorageConnectionString0)) - { - writer.WritePropertyName("aof-storage-connection-string-0"u8); - writer.WriteStringValue(AofStorageConnectionString0); - } - if (Optional.IsDefined(AofStorageConnectionString1)) - { - writer.WritePropertyName("aof-storage-connection-string-1"u8); - writer.WriteStringValue(AofStorageConnectionString1); - } - if (Optional.IsDefined(MaxFragmentationMemoryReserved)) - { - writer.WritePropertyName("maxfragmentationmemory-reserved"u8); - writer.WriteStringValue(MaxFragmentationMemoryReserved); - } - if (Optional.IsDefined(MaxMemoryPolicy)) - { - writer.WritePropertyName("maxmemory-policy"u8); - writer.WriteStringValue(MaxMemoryPolicy); - } - if (Optional.IsDefined(MaxMemoryReserved)) - { - writer.WritePropertyName("maxmemory-reserved"u8); - writer.WriteStringValue(MaxMemoryReserved); - } - if (Optional.IsDefined(MaxMemoryDelta)) - { - writer.WritePropertyName("maxmemory-delta"u8); - writer.WriteStringValue(MaxMemoryDelta); - } - if (options.Format != "W" && Optional.IsDefined(MaxClients)) - { - writer.WritePropertyName("maxclients"u8); - writer.WriteStringValue(MaxClients); - } - if (Optional.IsDefined(NotifyKeyspaceEvents)) - { - writer.WritePropertyName("notify-keyspace-events"u8); - writer.WriteStringValue(NotifyKeyspaceEvents); - } - if (options.Format != "W" && Optional.IsDefined(PreferredDataArchiveAuthMethod)) - { - writer.WritePropertyName("preferred-data-archive-auth-method"u8); - writer.WriteStringValue(PreferredDataArchiveAuthMethod); - } - if (Optional.IsDefined(PreferredDataPersistenceAuthMethod)) - { - writer.WritePropertyName("preferred-data-persistence-auth-method"u8); - writer.WriteStringValue(PreferredDataPersistenceAuthMethod); - } - if (options.Format != "W" && Optional.IsDefined(ZonalConfiguration)) - { - writer.WritePropertyName("zonal-configuration"u8); - writer.WriteStringValue(ZonalConfiguration); - } - if (Optional.IsDefined(AuthNotRequired)) - { - writer.WritePropertyName("authnotrequired"u8); - writer.WriteStringValue(AuthNotRequired); - } - if (Optional.IsDefined(StorageSubscriptionId)) - { - 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); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - - RedisCommonConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisCommonConfiguration)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisCommonConfiguration(document.RootElement, options); - } - - internal static RedisCommonConfiguration DeserializeRedisCommonConfiguration(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - bool? rdbBackupEnabled = default; - string rdbBackupFrequency = default; - int? rdbBackupMaxSnapshotCount = default; - string rdbStorageConnectionString = default; - bool? aofBackupEnabled = default; - string aofStorageConnectionString0 = default; - string aofStorageConnectionString1 = default; - string maxfragmentationmemoryReserved = default; - string maxmemoryPolicy = default; - string maxmemoryReserved = default; - string maxmemoryDelta = default; - string maxclients = default; - string notifyKeyspaceEvents = default; - string preferredDataArchiveAuthMethod = default; - string preferredDataPersistenceAuthMethod = default; - string zonalConfiguration = default; - string authnotrequired = default; - string storageSubscriptionId = default; - string aadEnabled = default; - IDictionary additionalProperties = default; - Dictionary additionalPropertiesDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("rdb-backup-enabled"u8)) - { - ReadIsRdbBackupEnabled(property, ref rdbBackupEnabled); - continue; - } - if (property.NameEquals("rdb-backup-frequency"u8)) - { - rdbBackupFrequency = property.Value.GetString(); - continue; - } - if (property.NameEquals("rdb-backup-max-snapshot-count"u8)) - { - ReadRdbBackupMaxSnapshotCount(property, ref rdbBackupMaxSnapshotCount); - continue; - } - if (property.NameEquals("rdb-storage-connection-string"u8)) - { - rdbStorageConnectionString = property.Value.GetString(); - continue; - } - if (property.NameEquals("aof-backup-enabled"u8)) - { - ReadIsAofBackupEnabled(property, ref aofBackupEnabled); - continue; - } - if (property.NameEquals("aof-storage-connection-string-0"u8)) - { - aofStorageConnectionString0 = property.Value.GetString(); - continue; - } - if (property.NameEquals("aof-storage-connection-string-1"u8)) - { - aofStorageConnectionString1 = property.Value.GetString(); - continue; - } - if (property.NameEquals("maxfragmentationmemory-reserved"u8)) - { - maxfragmentationmemoryReserved = property.Value.GetString(); - continue; - } - if (property.NameEquals("maxmemory-policy"u8)) - { - maxmemoryPolicy = property.Value.GetString(); - continue; - } - if (property.NameEquals("maxmemory-reserved"u8)) - { - maxmemoryReserved = property.Value.GetString(); - continue; - } - if (property.NameEquals("maxmemory-delta"u8)) - { - maxmemoryDelta = property.Value.GetString(); - continue; - } - if (property.NameEquals("maxclients"u8)) - { - maxclients = property.Value.GetString(); - continue; - } - if (property.NameEquals("notify-keyspace-events"u8)) - { - notifyKeyspaceEvents = property.Value.GetString(); - continue; - } - if (property.NameEquals("preferred-data-archive-auth-method"u8)) - { - preferredDataArchiveAuthMethod = property.Value.GetString(); - continue; - } - if (property.NameEquals("preferred-data-persistence-auth-method"u8)) - { - preferredDataPersistenceAuthMethod = property.Value.GetString(); - continue; - } - if (property.NameEquals("zonal-configuration"u8)) - { - zonalConfiguration = property.Value.GetString(); - continue; - } - if (property.NameEquals("authnotrequired"u8)) - { - authnotrequired = property.Value.GetString(); - continue; - } - if (property.NameEquals("storage-subscription-id"u8)) - { - 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( - rdbBackupEnabled, - rdbBackupFrequency, - rdbBackupMaxSnapshotCount, - rdbStorageConnectionString, - aofBackupEnabled, - aofStorageConnectionString0, - aofStorageConnectionString1, - maxfragmentationmemoryReserved, - maxmemoryPolicy, - maxmemoryReserved, - maxmemoryDelta, - maxclients, - notifyKeyspaceEvents, - preferredDataArchiveAuthMethod, - preferredDataPersistenceAuthMethod, - zonalConfiguration, - authnotrequired, - storageSubscriptionId, - aadEnabled, - additionalProperties); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsRdbBackupEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rdb-backup-enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsRdbBackupEnabled)) - { - builder.Append(" rdb-backup-enabled: "); - var boolValue = IsRdbBackupEnabled.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RdbBackupFrequency), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rdb-backup-frequency: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RdbBackupFrequency)) - { - builder.Append(" rdb-backup-frequency: "); - if (RdbBackupFrequency.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{RdbBackupFrequency}'''"); - } - else - { - builder.AppendLine($"'{RdbBackupFrequency}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RdbBackupMaxSnapshotCount), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rdb-backup-max-snapshot-count: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RdbBackupMaxSnapshotCount)) - { - builder.Append(" rdb-backup-max-snapshot-count: "); - builder.AppendLine($"{RdbBackupMaxSnapshotCount.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RdbStorageConnectionString), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rdb-storage-connection-string: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RdbStorageConnectionString)) - { - builder.Append(" rdb-storage-connection-string: "); - if (RdbStorageConnectionString.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{RdbStorageConnectionString}'''"); - } - else - { - builder.AppendLine($"'{RdbStorageConnectionString}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsAofBackupEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" aof-backup-enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsAofBackupEnabled)) - { - builder.Append(" aof-backup-enabled: "); - var boolValue = IsAofBackupEnabled.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AofStorageConnectionString0), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" aof-storage-connection-string-0: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AofStorageConnectionString0)) - { - builder.Append(" aof-storage-connection-string-0: "); - if (AofStorageConnectionString0.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{AofStorageConnectionString0}'''"); - } - else - { - builder.AppendLine($"'{AofStorageConnectionString0}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AofStorageConnectionString1), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" aof-storage-connection-string-1: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AofStorageConnectionString1)) - { - builder.Append(" aof-storage-connection-string-1: "); - if (AofStorageConnectionString1.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{AofStorageConnectionString1}'''"); - } - else - { - builder.AppendLine($"'{AofStorageConnectionString1}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxFragmentationMemoryReserved), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" maxfragmentationmemory-reserved: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxFragmentationMemoryReserved)) - { - builder.Append(" maxfragmentationmemory-reserved: "); - if (MaxFragmentationMemoryReserved.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{MaxFragmentationMemoryReserved}'''"); - } - else - { - builder.AppendLine($"'{MaxFragmentationMemoryReserved}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxMemoryPolicy), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" maxmemory-policy: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxMemoryPolicy)) - { - builder.Append(" maxmemory-policy: "); - if (MaxMemoryPolicy.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{MaxMemoryPolicy}'''"); - } - else - { - builder.AppendLine($"'{MaxMemoryPolicy}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxMemoryReserved), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" maxmemory-reserved: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxMemoryReserved)) - { - builder.Append(" maxmemory-reserved: "); - if (MaxMemoryReserved.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{MaxMemoryReserved}'''"); - } - else - { - builder.AppendLine($"'{MaxMemoryReserved}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxMemoryDelta), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" maxmemory-delta: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxMemoryDelta)) - { - builder.Append(" maxmemory-delta: "); - if (MaxMemoryDelta.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{MaxMemoryDelta}'''"); - } - else - { - builder.AppendLine($"'{MaxMemoryDelta}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxClients), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" maxclients: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxClients)) - { - builder.Append(" maxclients: "); - if (MaxClients.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{MaxClients}'''"); - } - else - { - builder.AppendLine($"'{MaxClients}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NotifyKeyspaceEvents), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" notify-keyspace-events: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NotifyKeyspaceEvents)) - { - builder.Append(" notify-keyspace-events: "); - if (NotifyKeyspaceEvents.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NotifyKeyspaceEvents}'''"); - } - else - { - builder.AppendLine($"'{NotifyKeyspaceEvents}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PreferredDataArchiveAuthMethod), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" preferred-data-archive-auth-method: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PreferredDataArchiveAuthMethod)) - { - builder.Append(" preferred-data-archive-auth-method: "); - if (PreferredDataArchiveAuthMethod.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{PreferredDataArchiveAuthMethod}'''"); - } - else - { - builder.AppendLine($"'{PreferredDataArchiveAuthMethod}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PreferredDataPersistenceAuthMethod), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" preferred-data-persistence-auth-method: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PreferredDataPersistenceAuthMethod)) - { - builder.Append(" preferred-data-persistence-auth-method: "); - if (PreferredDataPersistenceAuthMethod.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{PreferredDataPersistenceAuthMethod}'''"); - } - else - { - builder.AppendLine($"'{PreferredDataPersistenceAuthMethod}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ZonalConfiguration), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" zonal-configuration: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ZonalConfiguration)) - { - builder.Append(" zonal-configuration: "); - if (ZonalConfiguration.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ZonalConfiguration}'''"); - } - else - { - builder.AppendLine($"'{ZonalConfiguration}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AuthNotRequired), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" authnotrequired: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AuthNotRequired)) - { - builder.Append(" authnotrequired: "); - if (AuthNotRequired.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{AuthNotRequired}'''"); - } - else - { - builder.AppendLine($"'{AuthNotRequired}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StorageSubscriptionId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" storage-subscription-id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(StorageSubscriptionId)) - { - builder.Append(" storage-subscription-id: "); - if (StorageSubscriptionId.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{StorageSubscriptionId}'''"); - } - else - { - builder.AppendLine($"'{StorageSubscriptionId}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsAadEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" aad-enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsAadEnabled)) - { - builder.Append(" aad-enabled: "); - if (IsAadEnabled.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{IsAadEnabled}'''"); - } - else - { - builder.AppendLine($"'{IsAadEnabled}'"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); - default: - throw new FormatException($"The model {nameof(RedisCommonConfiguration)} does not support writing '{options.Format}' format."); - } - } - - RedisCommonConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisCommonConfiguration(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RedisCommonConfiguration)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.cs deleted file mode 100644 index 746f3487e18d..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.cs +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.Redis.Models -{ - /// All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta, maxmemory-policy,notify-keyspace-events, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-1 etc. - public partial class RedisCommonConfiguration - { - /// Initializes a new instance of . - public RedisCommonConfiguration() - { - AdditionalProperties = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// 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. - /// The keyspace events which should be monitored. - /// 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. - /// 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 notifyKeyspaceEvents, string preferredDataArchiveAuthMethod, string preferredDataPersistenceAuthMethod, string zonalConfiguration, string authNotRequired, string storageSubscriptionId, string isAadEnabled, IDictionary additionalProperties) - { - IsRdbBackupEnabled = isRdbBackupEnabled; - RdbBackupFrequency = rdbBackupFrequency; - RdbBackupMaxSnapshotCount = rdbBackupMaxSnapshotCount; - RdbStorageConnectionString = rdbStorageConnectionString; - IsAofBackupEnabled = isAofBackupEnabled; - AofStorageConnectionString0 = aofStorageConnectionString0; - AofStorageConnectionString1 = aofStorageConnectionString1; - MaxFragmentationMemoryReserved = maxFragmentationMemoryReserved; - MaxMemoryPolicy = maxMemoryPolicy; - MaxMemoryReserved = maxMemoryReserved; - MaxMemoryDelta = maxMemoryDelta; - MaxClients = maxClients; - NotifyKeyspaceEvents = notifyKeyspaceEvents; - PreferredDataArchiveAuthMethod = preferredDataArchiveAuthMethod; - PreferredDataPersistenceAuthMethod = preferredDataPersistenceAuthMethod; - ZonalConfiguration = zonalConfiguration; - AuthNotRequired = authNotRequired; - StorageSubscriptionId = storageSubscriptionId; - IsAadEnabled = isAadEnabled; - AdditionalProperties = additionalProperties; - } - - /// Specifies whether the rdb backup is enabled. - [WirePath("rdb-backup-enabled")] - public bool? IsRdbBackupEnabled { get; set; } - /// Specifies the frequency for creating rdb backup in minutes. Valid values: (15, 30, 60, 360, 720, 1440). - [WirePath("rdb-backup-frequency")] - public string RdbBackupFrequency { get; set; } - /// Specifies the maximum number of snapshots for rdb backup. - [WirePath("rdb-backup-max-snapshot-count")] - public int? RdbBackupMaxSnapshotCount { get; set; } - /// The storage account connection string for storing rdb file. - [WirePath("rdb-storage-connection-string")] - public string RdbStorageConnectionString { get; set; } - /// Specifies whether the aof backup is enabled. - [WirePath("aof-backup-enabled")] - public bool? IsAofBackupEnabled { get; set; } - /// First storage account connection string. - [WirePath("aof-storage-connection-string-0")] - public string AofStorageConnectionString0 { get; set; } - /// Second storage account connection string. - [WirePath("aof-storage-connection-string-1")] - public string AofStorageConnectionString1 { get; set; } - /// Value in megabytes reserved for fragmentation per shard. - [WirePath("maxfragmentationmemory-reserved")] - public string MaxFragmentationMemoryReserved { get; set; } - /// The eviction strategy used when your data won't fit within its memory limit. - [WirePath("maxmemory-policy")] - public string MaxMemoryPolicy { get; set; } - /// Value in megabytes reserved for non-cache usage per shard e.g. failover. - [WirePath("maxmemory-reserved")] - public string MaxMemoryReserved { get; set; } - /// Value in megabytes reserved for non-cache usage per shard e.g. failover. - [WirePath("maxmemory-delta")] - public string MaxMemoryDelta { get; set; } - /// The max clients config. - [WirePath("maxclients")] - public string MaxClients { get; } - /// The keyspace events which should be monitored. - [WirePath("notify-keyspace-events")] - public string NotifyKeyspaceEvents { get; set; } - /// Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. - [WirePath("preferred-data-archive-auth-method")] - public string PreferredDataArchiveAuthMethod { get; } - /// Preferred auth method to communicate to storage account used for data persistence, specify SAS or ManagedIdentity, default value is SAS. - [WirePath("preferred-data-persistence-auth-method")] - public string PreferredDataPersistenceAuthMethod { get; set; } - /// Zonal Configuration. - [WirePath("zonal-configuration")] - public string ZonalConfiguration { get; } - /// Specifies whether the authentication is disabled. Setting this property is highly discouraged from security point of view. - [WirePath("authnotrequired")] - public string AuthNotRequired { get; set; } - /// SubscriptionId of the storage account for persistence (aof/rdb) using ManagedIdentity. - [WirePath("storage-subscription-id")] - public string StorageSubscriptionId { get; set; } - /// Specifies whether AAD based authentication has been enabled or disabled for the cache. - [WirePath("aad-enabled")] - public string IsAadEnabled { get; set; } - /// - /// Additional Properties - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - [WirePath("AdditionalProperties")] - public IDictionary AdditionalProperties { get; } - } -} 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 deleted file mode 100644 index 38bfe2ff73aa..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.Serialization.cs +++ /dev/null @@ -1,455 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Net; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Redis.Models -{ - public partial class RedisCreateOrUpdateContent : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisCreateOrUpdateContent)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Zones)) - { - writer.WritePropertyName("zones"u8); - writer.WriteStartArray(); - foreach (var item in Zones) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location); - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(Identity)) - { - writer.WritePropertyName("identity"u8); - ((IJsonModel)Identity).Write(writer, options); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(RedisConfiguration)) - { - writer.WritePropertyName("redisConfiguration"u8); - writer.WriteObjectValue(RedisConfiguration, options); - } - if (Optional.IsDefined(RedisVersion)) - { - writer.WritePropertyName("redisVersion"u8); - writer.WriteStringValue(RedisVersion); - } - if (Optional.IsDefined(EnableNonSslPort)) - { - writer.WritePropertyName("enableNonSslPort"u8); - writer.WriteBooleanValue(EnableNonSslPort.Value); - } - if (Optional.IsDefined(ReplicasPerMaster)) - { - writer.WritePropertyName("replicasPerMaster"u8); - writer.WriteNumberValue(ReplicasPerMaster.Value); - } - if (Optional.IsDefined(ReplicasPerPrimary)) - { - writer.WritePropertyName("replicasPerPrimary"u8); - writer.WriteNumberValue(ReplicasPerPrimary.Value); - } - if (Optional.IsCollectionDefined(TenantSettings)) - { - writer.WritePropertyName("tenantSettings"u8); - writer.WriteStartObject(); - foreach (var item in TenantSettings) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(ShardCount)) - { - writer.WritePropertyName("shardCount"u8); - writer.WriteNumberValue(ShardCount.Value); - } - if (Optional.IsDefined(MinimumTlsVersion)) - { - writer.WritePropertyName("minimumTlsVersion"u8); - writer.WriteStringValue(MinimumTlsVersion.Value.ToString()); - } - if (Optional.IsDefined(PublicNetworkAccess)) - { - 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(IsAccessKeyAuthenticationDisabled)) - { - writer.WritePropertyName("disableAccessKeyAuthentication"u8); - writer.WriteBooleanValue(IsAccessKeyAuthenticationDisabled.Value); - } - if (Optional.IsDefined(ZonalAllocationPolicy)) - { - writer.WritePropertyName("zonalAllocationPolicy"u8); - writer.WriteStringValue(ZonalAllocationPolicy.Value.ToString()); - } - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku, options); - if (Optional.IsDefined(SubnetId)) - { - writer.WritePropertyName("subnetId"u8); - writer.WriteStringValue(SubnetId); - } - if (Optional.IsDefined(StaticIP)) - { - writer.WritePropertyName("staticIP"u8); - writer.WriteStringValue(StaticIP.ToString()); - } - writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RedisCreateOrUpdateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisCreateOrUpdateContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisCreateOrUpdateContent(document.RootElement, options); - } - - internal static RedisCreateOrUpdateContent DeserializeRedisCreateOrUpdateContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList zones = default; - AzureLocation location = default; - IDictionary tags = default; - ManagedServiceIdentity identity = default; - RedisCommonConfiguration redisConfiguration = default; - string redisVersion = default; - bool? enableNonSslPort = default; - int? replicasPerMaster = default; - int? replicasPerPrimary = default; - IDictionary tenantSettings = default; - int? shardCount = default; - RedisTlsVersion? minimumTlsVersion = default; - RedisPublicNetworkAccess? publicNetworkAccess = default; - UpdateChannel? updateChannel = default; - bool? disableAccessKeyAuthentication = default; - ZonalAllocationPolicy? zonalAllocationPolicy = default; - RedisSku sku = default; - ResourceIdentifier subnetId = default; - IPAddress staticIP = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("zones"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - zones = array; - continue; - } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("identity"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), options, AzureResourceManagerRedisContext.Default); - 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("redisConfiguration"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - redisConfiguration = RedisCommonConfiguration.DeserializeRedisCommonConfiguration(property0.Value, options); - continue; - } - if (property0.NameEquals("redisVersion"u8)) - { - redisVersion = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("enableNonSslPort"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableNonSslPort = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("replicasPerMaster"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - replicasPerMaster = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("replicasPerPrimary"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - replicasPerPrimary = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("tenantSettings"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property1 in property0.Value.EnumerateObject()) - { - dictionary.Add(property1.Name, property1.Value.GetString()); - } - tenantSettings = dictionary; - continue; - } - if (property0.NameEquals("shardCount"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - shardCount = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("minimumTlsVersion"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - minimumTlsVersion = new RedisTlsVersion(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("publicNetworkAccess"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - 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("disableAccessKeyAuthentication"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - disableAccessKeyAuthentication = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("zonalAllocationPolicy"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - zonalAllocationPolicy = new ZonalAllocationPolicy(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("sku"u8)) - { - sku = RedisSku.DeserializeRedisSku(property0.Value, options); - continue; - } - if (property0.NameEquals("subnetId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - subnetId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("staticIP"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - staticIP = IPAddress.Parse(property0.Value.GetString()); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RedisCreateOrUpdateContent( - zones ?? new ChangeTrackingList(), - location, - tags ?? new ChangeTrackingDictionary(), - identity, - redisConfiguration, - redisVersion, - enableNonSslPort, - replicasPerMaster, - replicasPerPrimary, - tenantSettings ?? new ChangeTrackingDictionary(), - shardCount, - minimumTlsVersion, - publicNetworkAccess, - updateChannel, - disableAccessKeyAuthentication, - zonalAllocationPolicy, - sku, - subnetId, - staticIP, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - default: - throw new FormatException($"The model {nameof(RedisCreateOrUpdateContent)} does not support writing '{options.Format}' format."); - } - } - - RedisCreateOrUpdateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisCreateOrUpdateContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RedisCreateOrUpdateContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.cs deleted file mode 100644 index aaa0dc790154..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.cs +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Net; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Redis.Models -{ - /// Parameters supplied to the Create Redis operation. - public partial class RedisCreateOrUpdateContent - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The geo-location where the resource lives. - /// The SKU of the Redis cache to deploy. - /// is null. - public RedisCreateOrUpdateContent(AzureLocation location, RedisSku sku) - { - Argument.AssertNotNull(sku, nameof(sku)); - - Zones = new ChangeTrackingList(); - Location = location; - Tags = new ChangeTrackingDictionary(); - TenantSettings = new ChangeTrackingDictionary(); - Sku = sku; - } - - /// Initializes a new instance of . - /// A list of availability zones denoting where the resource needs to come from. - /// The geo-location where the resource lives. - /// Resource tags. - /// 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, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-1 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'. - /// 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'. - /// Authentication to Redis through access keys is disabled when set as true. Default value is false. - /// Optional: Specifies how availability zones are allocated to the Redis cache. 'Automatic' enables zone redundancy and Azure will automatically select zones based on regional availability and capacity. 'UserDefined' will select availability zones passed in by you using the 'zones' parameter. 'NoZones' will produce a non-zonal cache. If 'zonalAllocationPolicy' is not passed, it will be set to 'UserDefined' when zones are passed in, otherwise, it will be set to 'Automatic' in regions where zones are supported and 'NoZones' in regions where zones are not supported. - /// 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. - /// Keeps track of any properties unknown to the library. - 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, bool? isAccessKeyAuthenticationDisabled, ZonalAllocationPolicy? zonalAllocationPolicy, RedisSku sku, ResourceIdentifier subnetId, IPAddress staticIP, IDictionary serializedAdditionalRawData) - { - Zones = zones; - Location = location; - Tags = tags; - Identity = identity; - RedisConfiguration = redisConfiguration; - RedisVersion = redisVersion; - EnableNonSslPort = enableNonSslPort; - ReplicasPerMaster = replicasPerMaster; - ReplicasPerPrimary = replicasPerPrimary; - TenantSettings = tenantSettings; - ShardCount = shardCount; - MinimumTlsVersion = minimumTlsVersion; - PublicNetworkAccess = publicNetworkAccess; - UpdateChannel = updateChannel; - IsAccessKeyAuthenticationDisabled = isAccessKeyAuthenticationDisabled; - ZonalAllocationPolicy = zonalAllocationPolicy; - Sku = sku; - SubnetId = subnetId; - StaticIP = staticIP; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RedisCreateOrUpdateContent() - { - } - - /// A list of availability zones denoting where the resource needs to come from. - [WirePath("zones")] - public IList Zones { get; } - /// The geo-location where the resource lives. - [WirePath("location")] - public AzureLocation Location { get; } - /// Resource tags. - [WirePath("tags")] - public IDictionary Tags { get; } - /// The identity of the resource. - [WirePath("identity")] - public ManagedServiceIdentity Identity { get; set; } - /// All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta, maxmemory-policy,notify-keyspace-events, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-1 etc. - [WirePath("properties.redisConfiguration")] - public RedisCommonConfiguration RedisConfiguration { get; set; } - /// 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'. - [WirePath("properties.redisVersion")] - public string RedisVersion { get; set; } - /// Specifies whether the non-ssl Redis server port (6379) is enabled. - [WirePath("properties.enableNonSslPort")] - public bool? EnableNonSslPort { get; set; } - /// The number of replicas to be created per primary. - [WirePath("properties.replicasPerMaster")] - public int? ReplicasPerMaster { get; set; } - /// The number of replicas to be created per primary. - [WirePath("properties.replicasPerPrimary")] - public int? ReplicasPerPrimary { get; set; } - /// A dictionary of tenant settings. - [WirePath("properties.tenantSettings")] - public IDictionary TenantSettings { get; } - /// The number of shards to be created on a Premium Cluster Cache. - [WirePath("properties.shardCount")] - public int? ShardCount { get; set; } - /// Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). - [WirePath("properties.minimumTlsVersion")] - 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'. - [WirePath("properties.publicNetworkAccess")] - 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'. - [WirePath("properties.updateChannel")] - public UpdateChannel? UpdateChannel { get; set; } - /// Authentication to Redis through access keys is disabled when set as true. Default value is false. - [WirePath("properties.disableAccessKeyAuthentication")] - public bool? IsAccessKeyAuthenticationDisabled { get; set; } - /// Optional: Specifies how availability zones are allocated to the Redis cache. 'Automatic' enables zone redundancy and Azure will automatically select zones based on regional availability and capacity. 'UserDefined' will select availability zones passed in by you using the 'zones' parameter. 'NoZones' will produce a non-zonal cache. If 'zonalAllocationPolicy' is not passed, it will be set to 'UserDefined' when zones are passed in, otherwise, it will be set to 'Automatic' in regions where zones are supported and 'NoZones' in regions where zones are not supported. - [WirePath("properties.zonalAllocationPolicy")] - public ZonalAllocationPolicy? ZonalAllocationPolicy { get; set; } - /// The SKU of the Redis cache to deploy. - [WirePath("properties.sku")] - 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. - [WirePath("properties.subnetId")] - public ResourceIdentifier SubnetId { get; set; } - /// Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. - [WirePath("properties.staticIP")] - public IPAddress StaticIP { get; set; } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisDayOfWeek.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisDayOfWeek.Serialization.cs deleted file mode 100644 index 1bd8f1eb0380..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisDayOfWeek.Serialization.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Redis.Models -{ - internal static partial class RedisDayOfWeekExtensions - { - public static string ToSerialString(this RedisDayOfWeek value) => value switch - { - RedisDayOfWeek.Monday => "Monday", - RedisDayOfWeek.Tuesday => "Tuesday", - RedisDayOfWeek.Wednesday => "Wednesday", - RedisDayOfWeek.Thursday => "Thursday", - RedisDayOfWeek.Friday => "Friday", - RedisDayOfWeek.Saturday => "Saturday", - RedisDayOfWeek.Sunday => "Sunday", - RedisDayOfWeek.Everyday => "Everyday", - RedisDayOfWeek.Weekend => "Weekend", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisDayOfWeek value.") - }; - - public static RedisDayOfWeek ToRedisDayOfWeek(this string value) - { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Monday")) return RedisDayOfWeek.Monday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Tuesday")) return RedisDayOfWeek.Tuesday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Wednesday")) return RedisDayOfWeek.Wednesday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Thursday")) return RedisDayOfWeek.Thursday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Friday")) return RedisDayOfWeek.Friday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Saturday")) return RedisDayOfWeek.Saturday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Sunday")) return RedisDayOfWeek.Sunday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Everyday")) return RedisDayOfWeek.Everyday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Weekend")) return RedisDayOfWeek.Weekend; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisDayOfWeek value."); - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.Serialization.cs index f5276f9ce1b8..9853fb5e990d 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.Serialization.cs @@ -8,8 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; using Azure.Core; @@ -36,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(RedisFirewallRuleListResult)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +84,13 @@ internal static RedisFirewallRuleListResult DeserializeRedisFirewallRuleListResu return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); 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()) { @@ -110,7 +101,11 @@ internal static RedisFirewallRuleListResult DeserializeRedisFirewallRuleListResu } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,68 +114,7 @@ internal static RedisFirewallRuleListResult DeserializeRedisFirewallRuleListResu } } serializedAdditionalRawData = rawDataDictionary; - return new RedisFirewallRuleListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); + return new RedisFirewallRuleListResult(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) @@ -191,8 +125,6 @@ BinaryData IPersistableModel.Write(ModelReaderWrite { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisFirewallRuleListResult)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.cs index 32fdc9c28246..26b039501daa 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.cs @@ -7,10 +7,11 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Redis.Models { - /// The response of list firewall rules Redis operation. + /// The response of a RedisFirewallRule list operation. internal partial class RedisFirewallRuleListResult { /// @@ -46,25 +47,34 @@ internal partial class RedisFirewallRuleListResult private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal RedisFirewallRuleListResult() + /// The RedisFirewallRule items on this page. + /// is null. + internal RedisFirewallRuleListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list firewall rules operation. - /// Link for next page of results. + /// The RedisFirewallRule items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal RedisFirewallRuleListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal RedisFirewallRuleListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Results of the list firewall rules operation. + /// Initializes a new instance of for deserialization. + internal RedisFirewallRuleListResult() + { + } + + /// The RedisFirewallRule items on this page. public IReadOnlyList Value { get; } - /// Link for next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResponse.Serialization.cs similarity index 52% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.Serialization.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResponse.Serialization.cs index c85ba00f5446..6d115a1cdab4 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResponse.Serialization.cs @@ -8,17 +8,16 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; using Azure.Core; namespace Azure.ResourceManager.Redis.Models { - public partial class RedisForceRebootResult : IUtf8JsonSerializable, IJsonModel + public partial class RedisForceRebootResponse : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -29,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(RedisForceRebootResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(RedisForceRebootResponse)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(Message)) @@ -57,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - RedisForceRebootResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + RedisForceRebootResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(RedisForceRebootResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(RedisForceRebootResponse)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisForceRebootResult(document.RootElement, options); + return DeserializeRedisForceRebootResponse(document.RootElement, options); } - internal static RedisForceRebootResult DeserializeRedisForceRebootResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static RedisForceRebootResponse DeserializeRedisForceRebootResponse(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -93,78 +92,38 @@ internal static RedisForceRebootResult DeserializeRedisForceRebootResult(JsonEle } } serializedAdditionalRawData = rawDataDictionary; - return new RedisForceRebootResult(message, serializedAdditionalRawData); + return new RedisForceRebootResponse(message, serializedAdditionalRawData); } - private BinaryData SerializeBicep(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Message), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" message: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Message)) - { - builder.Append(" message: "); - if (Message.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Message}'''"); - } - else - { - builder.AppendLine($"'{Message}'"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(RedisForceRebootResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisForceRebootResponse)} does not support writing '{options.Format}' format."); } } - RedisForceRebootResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + RedisForceRebootResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisForceRebootResult(document.RootElement, options); + return DeserializeRedisForceRebootResponse(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(RedisForceRebootResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisForceRebootResponse)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResponse.cs similarity index 87% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResponse.cs index d50ab852279f..27f0813339d8 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResponse.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Response to force reboot for Redis cache. - public partial class RedisForceRebootResult + public partial class RedisForceRebootResponse { /// /// Keeps track of any properties unknown to the library. @@ -45,22 +45,21 @@ public partial class RedisForceRebootResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal RedisForceRebootResult() + /// Initializes a new instance of . + internal RedisForceRebootResponse() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Status message. /// Keeps track of any properties unknown to the library. - internal RedisForceRebootResult(string message, IDictionary serializedAdditionalRawData) + internal RedisForceRebootResponse(string message, IDictionary serializedAdditionalRawData) { Message = message; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Status message. - [WirePath("message")] public string Message { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.Serialization.cs index 8ad21976b2d8..c95555873caf 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.Serialization.cs @@ -8,7 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; using Azure.Core; @@ -178,121 +177,6 @@ internal static RedisInstanceDetails DeserializeRedisInstanceDetails(JsonElement serializedAdditionalRawData); } - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SslPort), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" sslPort: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SslPort)) - { - builder.Append(" sslPort: "); - builder.AppendLine($"{SslPort.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NonSslPort), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nonSslPort: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NonSslPort)) - { - builder.Append(" nonSslPort: "); - builder.AppendLine($"{NonSslPort.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Zone), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" zone: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Zone)) - { - builder.Append(" zone: "); - if (Zone.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Zone}'''"); - } - else - { - builder.AppendLine($"'{Zone}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ShardId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" shardId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ShardId)) - { - builder.Append(" shardId: "); - builder.AppendLine($"{ShardId.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsMaster), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" isMaster: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsMaster)) - { - builder.Append(" isMaster: "); - var boolValue = IsMaster.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsPrimary), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" isPrimary: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsPrimary)) - { - builder.Append(" isPrimary: "); - var boolValue = IsPrimary.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -301,8 +185,6 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOption { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisInstanceDetails)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.cs index 5ec865872750..21663eb4c056 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.cs @@ -70,22 +70,16 @@ internal RedisInstanceDetails(int? sslPort, int? nonSslPort, string zone, int? s } /// Redis instance SSL port. - [WirePath("sslPort")] public int? SslPort { get; } /// If enableNonSslPort is true, provides Redis instance Non-SSL port. - [WirePath("nonSslPort")] public int? NonSslPort { get; } /// If the Cache uses availability zones, specifies availability zone where this instance is located. - [WirePath("zone")] public string Zone { get; } /// If clustering is enabled, the Shard ID of Redis Instance. - [WirePath("shardId")] public int? ShardId { get; } /// Specifies whether the instance is a primary node. - [WirePath("isMaster")] public bool? IsMaster { get; } /// Specifies whether the instance is a primary node. - [WirePath("isPrimary")] public bool? IsPrimary { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisKeyType.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisKeyType.Serialization.cs new file mode 100644 index 000000000000..96c36d69b65d --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisKeyType.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Redis.Models +{ + internal static partial class RedisKeyTypeExtensions + { + public static string ToSerialString(this RedisKeyType value) => value switch + { + RedisKeyType.Primary => "Primary", + RedisKeyType.Secondary => "Secondary", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisKeyType value.") + }; + + public static RedisKeyType ToRedisKeyType(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Primary")) return RedisKeyType.Primary; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Secondary")) return RedisKeyType.Secondary; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisKeyType value."); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyType.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisKeyType.cs similarity index 66% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyType.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisKeyType.cs index bcafad8b21db..4557eda059f7 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyType.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisKeyType.cs @@ -8,11 +8,11 @@ namespace Azure.ResourceManager.Redis.Models { /// The Redis access key to regenerate. - public enum RedisRegenerateKeyType + public enum RedisKeyType { - /// Primary. + /// The primary access key *. Primary, - /// Secondary. + /// The secondary access key *. Secondary } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerRole.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerRole.Serialization.cs deleted file mode 100644 index 5caa670a7475..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerRole.Serialization.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Redis.Models -{ - internal static partial class RedisLinkedServerRoleExtensions - { - public static string ToSerialString(this RedisLinkedServerRole value) => value switch - { - RedisLinkedServerRole.Primary => "Primary", - RedisLinkedServerRole.Secondary => "Secondary", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisLinkedServerRole value.") - }; - - public static RedisLinkedServerRole ToRedisLinkedServerRole(this string value) - { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Primary")) return RedisLinkedServerRole.Primary; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Secondary")) return RedisLinkedServerRole.Secondary; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisLinkedServerRole value."); - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.Serialization.cs index 0f835e4978b8..572e1bbf09eb 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.Serialization.cs @@ -8,8 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; using Azure.Core; @@ -36,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(RedisLinkedServerWithPropertiesList)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +84,13 @@ internal static RedisLinkedServerWithPropertiesList DeserializeRedisLinkedServer return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); 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()) { @@ -110,7 +101,11 @@ internal static RedisLinkedServerWithPropertiesList DeserializeRedisLinkedServer } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,68 +114,7 @@ internal static RedisLinkedServerWithPropertiesList DeserializeRedisLinkedServer } } serializedAdditionalRawData = rawDataDictionary; - return new RedisLinkedServerWithPropertiesList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); + return new RedisLinkedServerWithPropertiesList(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) @@ -191,8 +125,6 @@ BinaryData IPersistableModel.Write(ModelRea { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisLinkedServerWithPropertiesList)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.cs index 350918c65e8f..b3ab0651caa9 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Redis.Models { @@ -46,25 +47,34 @@ internal partial class RedisLinkedServerWithPropertiesList private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal RedisLinkedServerWithPropertiesList() + /// The RedisLinkedServerWithProperties items on this page. + /// is null. + internal RedisLinkedServerWithPropertiesList(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of linked servers (with properties) of a Redis cache. - /// Link for next set. + /// The RedisLinkedServerWithProperties items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal RedisLinkedServerWithPropertiesList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal RedisLinkedServerWithPropertiesList(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of linked servers (with properties) of a Redis cache. + /// Initializes a new instance of for deserialization. + internal RedisLinkedServerWithPropertiesList() + { + } + + /// The RedisLinkedServerWithProperties items on this page. public IReadOnlyList Value { get; } - /// Link for next set. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.Serialization.cs index 784e7a923dea..422a78ae6545 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.Serialization.cs @@ -90,9 +90,9 @@ internal static RedisLinkedServerWithPropertyCreateOrUpdateContent DeserializeRe { return null; } - ResourceIdentifier linkedRedisCacheId = default; - AzureLocation linkedRedisCacheLocation = default; - RedisLinkedServerRole serverRole = default; + string linkedRedisCacheId = default; + string linkedRedisCacheLocation = default; + ReplicationRole serverRole = default; string geoReplicatedPrimaryHostName = default; string primaryHostName = default; IDictionary serializedAdditionalRawData = default; @@ -110,17 +110,17 @@ internal static RedisLinkedServerWithPropertyCreateOrUpdateContent DeserializeRe { if (property0.NameEquals("linkedRedisCacheId"u8)) { - linkedRedisCacheId = new ResourceIdentifier(property0.Value.GetString()); + linkedRedisCacheId = property0.Value.GetString(); continue; } if (property0.NameEquals("linkedRedisCacheLocation"u8)) { - linkedRedisCacheLocation = new AzureLocation(property0.Value.GetString()); + linkedRedisCacheLocation = property0.Value.GetString(); continue; } if (property0.NameEquals("serverRole"u8)) { - serverRole = property0.Value.GetString().ToRedisLinkedServerRole(); + serverRole = property0.Value.GetString().ToReplicationRole(); continue; } if (property0.NameEquals("geoReplicatedPrimaryHostName"u8)) diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.cs index c0211f7efd62..b7807a71b018 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.Redis.Models { @@ -50,10 +49,11 @@ public partial class RedisLinkedServerWithPropertyCreateOrUpdateContent /// Fully qualified resourceId of the linked redis cache. /// Location of the linked redis cache. /// Role of the linked server. - /// is null. - public RedisLinkedServerWithPropertyCreateOrUpdateContent(ResourceIdentifier linkedRedisCacheId, AzureLocation linkedRedisCacheLocation, RedisLinkedServerRole serverRole) + /// or is null. + public RedisLinkedServerWithPropertyCreateOrUpdateContent(string linkedRedisCacheId, string linkedRedisCacheLocation, ReplicationRole serverRole) { Argument.AssertNotNull(linkedRedisCacheId, nameof(linkedRedisCacheId)); + Argument.AssertNotNull(linkedRedisCacheLocation, nameof(linkedRedisCacheLocation)); LinkedRedisCacheId = linkedRedisCacheId; LinkedRedisCacheLocation = linkedRedisCacheLocation; @@ -67,7 +67,7 @@ public RedisLinkedServerWithPropertyCreateOrUpdateContent(ResourceIdentifier lin /// The unchanging DNS name which will always point to current geo-primary cache among the linked redis caches for seamless Geo Failover experience. /// The changing DNS name that resolves to the current geo-primary cache among the linked redis caches before or after the Geo Failover. /// Keeps track of any properties unknown to the library. - internal RedisLinkedServerWithPropertyCreateOrUpdateContent(ResourceIdentifier linkedRedisCacheId, AzureLocation linkedRedisCacheLocation, RedisLinkedServerRole serverRole, string geoReplicatedPrimaryHostName, string primaryHostName, IDictionary serializedAdditionalRawData) + internal RedisLinkedServerWithPropertyCreateOrUpdateContent(string linkedRedisCacheId, string linkedRedisCacheLocation, ReplicationRole serverRole, string geoReplicatedPrimaryHostName, string primaryHostName, IDictionary serializedAdditionalRawData) { LinkedRedisCacheId = linkedRedisCacheId; LinkedRedisCacheLocation = linkedRedisCacheLocation; @@ -83,19 +83,14 @@ internal RedisLinkedServerWithPropertyCreateOrUpdateContent() } /// Fully qualified resourceId of the linked redis cache. - [WirePath("properties.linkedRedisCacheId")] - public ResourceIdentifier LinkedRedisCacheId { get; } + public string LinkedRedisCacheId { get; } /// Location of the linked redis cache. - [WirePath("properties.linkedRedisCacheLocation")] - public AzureLocation LinkedRedisCacheLocation { get; } + public string LinkedRedisCacheLocation { get; } /// Role of the linked server. - [WirePath("properties.serverRole")] - public RedisLinkedServerRole ServerRole { get; } + public ReplicationRole ServerRole { get; } /// The unchanging DNS name which will always point to current geo-primary cache among the linked redis caches for seamless Geo Failover experience. - [WirePath("properties.geoReplicatedPrimaryHostName")] public string GeoReplicatedPrimaryHostName { get; } /// The changing DNS name that resolves to the current geo-primary cache among the linked redis caches before or after the Geo Failover. - [WirePath("properties.primaryHostName")] public string PrimaryHostName { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.Serialization.cs index 039946578d8e..3c01f679fa3f 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.Serialization.cs @@ -8,8 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; using Azure.Core; @@ -36,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(RedisListResult)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -88,29 +83,29 @@ internal static RedisListResult DeserializeRedisListResult(JsonElement element, { return null; } - IReadOnlyList value = default; - string nextLink = default; + IReadOnlyList value = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(RedisData.DeserializeRedisData(item, options)); + array.Add(RedisResourceData.DeserializeRedisResourceData(item, options)); } value = array; continue; } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,68 +114,7 @@ internal static RedisListResult DeserializeRedisListResult(JsonElement element, } } serializedAdditionalRawData = rawDataDictionary; - return new RedisListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); + return new RedisListResult(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) @@ -191,8 +125,6 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opt { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisListResult)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.cs index dd1c5f26cd5f..d5a42fff1268 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Redis.Models { @@ -46,25 +47,34 @@ internal partial class RedisListResult private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal RedisListResult() + /// The RedisResource items on this page. + /// is null. + internal RedisListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// List of Redis cache instances. - /// Link for next page of results. + /// The RedisResource items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal RedisListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal RedisListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of Redis cache instances. - public IReadOnlyList Value { get; } - /// Link for next page of results. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal RedisListResult() + { + } + + /// The RedisResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.Serialization.cs deleted file mode 100644 index 15b44231dc37..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.Serialization.cs +++ /dev/null @@ -1,446 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Redis.Models -{ - public partial class RedisOperationStatus : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisOperationStatus)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsCollectionDefined(Properties)) - { - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - foreach (var item in Properties) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - writer.WriteEndObject(); - } - } - - RedisOperationStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisOperationStatus)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisOperationStatus(document.RootElement, options); - } - - internal static RedisOperationStatus DeserializeRedisOperationStatus(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyDictionary properties = default; - ResourceIdentifier id = default; - string name = default; - string status = default; - float? percentComplete = default; - DateTimeOffset? startTime = default; - DateTimeOffset? endTime = default; - IReadOnlyList operations = default; - ResponseError error = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); - } - } - properties = dictionary; - continue; - } - if (property.NameEquals("id"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = property.Value.GetString(); - continue; - } - if (property.NameEquals("percentComplete"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - percentComplete = null; - continue; - } - percentComplete = property.Value.GetSingle(); - continue; - } - if (property.NameEquals("startTime"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - startTime = null; - continue; - } - startTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("endTime"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - endTime = null; - continue; - } - endTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("operations"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - if (item.ValueKind == JsonValueKind.Null) - { - array.Add(null); - } - else - { - array.Add(ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(item.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerRedisContext.Default)); - } - } - operations = array; - continue; - } - if (property.NameEquals("error"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - error = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerRedisContext.Default); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RedisOperationStatus( - id, - name, - status, - percentComplete, - startTime, - endTime, - operations ?? new ChangeTrackingList(), - error, - properties ?? new ChangeTrackingDictionary(), - serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" properties: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Properties)) - { - if (Properties.Any()) - { - builder.Append(" properties: "); - builder.AppendLine("{"); - foreach (var item in Properties) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - builder.AppendLine($"'{item.Value.ToString()}'"); - } - builder.AppendLine(" }"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Id)) - { - builder.Append(" id: "); - builder.AppendLine($"'{Id.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Name)) - { - builder.Append(" name: "); - if (Name.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Name}'''"); - } - else - { - builder.AppendLine($"'{Name}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" status: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Status)) - { - builder.Append(" status: "); - if (Status.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Status}'''"); - } - else - { - builder.AppendLine($"'{Status}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PercentComplete), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" percentComplete: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PercentComplete)) - { - builder.Append(" percentComplete: "); - builder.AppendLine($"'{PercentComplete.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartOn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" startTime: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(StartOn)) - { - builder.Append(" startTime: "); - var formattedDateTimeString = TypeFormatters.ToString(StartOn.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndOn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" endTime: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EndOn)) - { - builder.Append(" endTime: "); - var formattedDateTimeString = TypeFormatters.ToString(EndOn.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Operations), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" operations: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Operations)) - { - if (Operations.Any()) - { - builder.Append(" operations: "); - builder.AppendLine("["); - foreach (var item in Operations) - { - if (item == null) - { - builder.Append("null"); - continue; - } - builder.AppendLine($" '{item.ToString()}'"); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Error), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" error: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Error)) - { - builder.Append(" error: "); - builder.AppendLine($"'{Error.ToString()}'"); - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); - default: - throw new FormatException($"The model {nameof(RedisOperationStatus)} does not support writing '{options.Format}' format."); - } - } - - RedisOperationStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisOperationStatus(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RedisOperationStatus)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} 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 deleted file mode 100644 index 46cb2544ceab..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.Serialization.cs +++ /dev/null @@ -1,394 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Redis.Models -{ - public partial class RedisPatch : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisPatch)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(Identity)) - { - writer.WritePropertyName("identity"u8); - ((IJsonModel)Identity).Write(writer, options); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(RedisConfiguration)) - { - writer.WritePropertyName("redisConfiguration"u8); - writer.WriteObjectValue(RedisConfiguration, options); - } - if (Optional.IsDefined(RedisVersion)) - { - writer.WritePropertyName("redisVersion"u8); - writer.WriteStringValue(RedisVersion); - } - if (Optional.IsDefined(EnableNonSslPort)) - { - writer.WritePropertyName("enableNonSslPort"u8); - writer.WriteBooleanValue(EnableNonSslPort.Value); - } - if (Optional.IsDefined(ReplicasPerMaster)) - { - writer.WritePropertyName("replicasPerMaster"u8); - writer.WriteNumberValue(ReplicasPerMaster.Value); - } - if (Optional.IsDefined(ReplicasPerPrimary)) - { - writer.WritePropertyName("replicasPerPrimary"u8); - writer.WriteNumberValue(ReplicasPerPrimary.Value); - } - if (Optional.IsCollectionDefined(TenantSettings)) - { - writer.WritePropertyName("tenantSettings"u8); - writer.WriteStartObject(); - foreach (var item in TenantSettings) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(ShardCount)) - { - writer.WritePropertyName("shardCount"u8); - writer.WriteNumberValue(ShardCount.Value); - } - if (Optional.IsDefined(MinimumTlsVersion)) - { - writer.WritePropertyName("minimumTlsVersion"u8); - writer.WriteStringValue(MinimumTlsVersion.Value.ToString()); - } - if (Optional.IsDefined(PublicNetworkAccess)) - { - 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(IsAccessKeyAuthenticationDisabled)) - { - writer.WritePropertyName("disableAccessKeyAuthentication"u8); - writer.WriteBooleanValue(IsAccessKeyAuthenticationDisabled.Value); - } - if (Optional.IsDefined(ZonalAllocationPolicy)) - { - writer.WritePropertyName("zonalAllocationPolicy"u8); - writer.WriteStringValue(ZonalAllocationPolicy.Value.ToString()); - } - if (Optional.IsDefined(Sku)) - { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku, options); - } - writer.WriteEndObject(); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RedisPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisPatch)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisPatch(document.RootElement, options); - } - - internal static RedisPatch DeserializeRedisPatch(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IDictionary tags = default; - ManagedServiceIdentity identity = default; - RedisCommonConfiguration redisConfiguration = default; - string redisVersion = default; - bool? enableNonSslPort = default; - int? replicasPerMaster = default; - int? replicasPerPrimary = default; - IDictionary tenantSettings = default; - int? shardCount = default; - RedisTlsVersion? minimumTlsVersion = default; - RedisPublicNetworkAccess? publicNetworkAccess = default; - UpdateChannel? updateChannel = default; - bool? disableAccessKeyAuthentication = default; - ZonalAllocationPolicy? zonalAllocationPolicy = default; - RedisSku sku = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("identity"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), options, AzureResourceManagerRedisContext.Default); - 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("redisConfiguration"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - redisConfiguration = RedisCommonConfiguration.DeserializeRedisCommonConfiguration(property0.Value, options); - continue; - } - if (property0.NameEquals("redisVersion"u8)) - { - redisVersion = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("enableNonSslPort"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableNonSslPort = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("replicasPerMaster"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - replicasPerMaster = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("replicasPerPrimary"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - replicasPerPrimary = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("tenantSettings"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property1 in property0.Value.EnumerateObject()) - { - dictionary.Add(property1.Name, property1.Value.GetString()); - } - tenantSettings = dictionary; - continue; - } - if (property0.NameEquals("shardCount"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - shardCount = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("minimumTlsVersion"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - minimumTlsVersion = new RedisTlsVersion(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("publicNetworkAccess"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - 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("disableAccessKeyAuthentication"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - disableAccessKeyAuthentication = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("zonalAllocationPolicy"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - zonalAllocationPolicy = new ZonalAllocationPolicy(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("sku"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sku = RedisSku.DeserializeRedisSku(property0.Value, options); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RedisPatch( - tags ?? new ChangeTrackingDictionary(), - identity, - redisConfiguration, - redisVersion, - enableNonSslPort, - replicasPerMaster, - replicasPerPrimary, - tenantSettings ?? new ChangeTrackingDictionary(), - shardCount, - minimumTlsVersion, - publicNetworkAccess, - updateChannel, - disableAccessKeyAuthentication, - zonalAllocationPolicy, - sku, - serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - default: - throw new FormatException($"The model {nameof(RedisPatch)} does not support writing '{options.Format}' format."); - } - } - - RedisPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisPatch(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RedisPatch)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.cs deleted file mode 100644 index 424516d4834d..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.cs +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Redis.Models -{ - /// Parameters supplied to the Update Redis operation. - public partial class RedisPatch - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public RedisPatch() - { - Tags = new ChangeTrackingDictionary(); - TenantSettings = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// Resource tags. - /// 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, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-1 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'. - /// 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'. - /// Authentication to Redis through access keys is disabled when set as true. Default value is false. - /// Optional: Specifies how availability zones are allocated to the Redis cache. 'Automatic' enables zone redundancy and Azure will automatically select zones based on regional availability and capacity. 'UserDefined' will select availability zones passed in by you using the 'zones' parameter. 'NoZones' will produce a non-zonal cache. If 'zonalAllocationPolicy' is not passed, it will be set to 'UserDefined' when zones are passed in, otherwise, it will be set to 'Automatic' in regions where zones are supported and 'NoZones' in regions where zones are not supported. - /// The SKU of the Redis cache to deploy. - /// Keeps track of any properties unknown to the library. - 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, bool? isAccessKeyAuthenticationDisabled, ZonalAllocationPolicy? zonalAllocationPolicy, RedisSku sku, IDictionary serializedAdditionalRawData) - { - Tags = tags; - Identity = identity; - RedisConfiguration = redisConfiguration; - RedisVersion = redisVersion; - EnableNonSslPort = enableNonSslPort; - ReplicasPerMaster = replicasPerMaster; - ReplicasPerPrimary = replicasPerPrimary; - TenantSettings = tenantSettings; - ShardCount = shardCount; - MinimumTlsVersion = minimumTlsVersion; - PublicNetworkAccess = publicNetworkAccess; - UpdateChannel = updateChannel; - IsAccessKeyAuthenticationDisabled = isAccessKeyAuthenticationDisabled; - ZonalAllocationPolicy = zonalAllocationPolicy; - Sku = sku; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Resource tags. - [WirePath("tags")] - public IDictionary Tags { get; } - /// The identity of the resource. - [WirePath("identity")] - public ManagedServiceIdentity Identity { get; set; } - /// All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta, maxmemory-policy,notify-keyspace-events, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-1 etc. - [WirePath("properties.redisConfiguration")] - public RedisCommonConfiguration RedisConfiguration { get; set; } - /// 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'. - [WirePath("properties.redisVersion")] - public string RedisVersion { get; set; } - /// Specifies whether the non-ssl Redis server port (6379) is enabled. - [WirePath("properties.enableNonSslPort")] - public bool? EnableNonSslPort { get; set; } - /// The number of replicas to be created per primary. - [WirePath("properties.replicasPerMaster")] - public int? ReplicasPerMaster { get; set; } - /// The number of replicas to be created per primary. - [WirePath("properties.replicasPerPrimary")] - public int? ReplicasPerPrimary { get; set; } - /// A dictionary of tenant settings. - [WirePath("properties.tenantSettings")] - public IDictionary TenantSettings { get; } - /// The number of shards to be created on a Premium Cluster Cache. - [WirePath("properties.shardCount")] - public int? ShardCount { get; set; } - /// Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). - [WirePath("properties.minimumTlsVersion")] - 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'. - [WirePath("properties.publicNetworkAccess")] - 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'. - [WirePath("properties.updateChannel")] - public UpdateChannel? UpdateChannel { get; set; } - /// Authentication to Redis through access keys is disabled when set as true. Default value is false. - [WirePath("properties.disableAccessKeyAuthentication")] - public bool? IsAccessKeyAuthenticationDisabled { get; set; } - /// Optional: Specifies how availability zones are allocated to the Redis cache. 'Automatic' enables zone redundancy and Azure will automatically select zones based on regional availability and capacity. 'UserDefined' will select availability zones passed in by you using the 'zones' parameter. 'NoZones' will produce a non-zonal cache. If 'zonalAllocationPolicy' is not passed, it will be set to 'UserDefined' when zones are passed in, otherwise, it will be set to 'Automatic' in regions where zones are supported and 'NoZones' in regions where zones are not supported. - [WirePath("properties.zonalAllocationPolicy")] - public ZonalAllocationPolicy? ZonalAllocationPolicy { get; set; } - /// The SKU of the Redis cache to deploy. - [WirePath("properties.sku")] - public RedisSku Sku { get; set; } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleDefaultName.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleDefaultName.cs deleted file mode 100644 index aad11ae4d0a8..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleDefaultName.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Redis.Models -{ - /// The RedisPatchScheduleDefaultName. - public readonly partial struct RedisPatchScheduleDefaultName : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RedisPatchScheduleDefaultName(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string DefaultValue = "default"; - - /// default. - public static RedisPatchScheduleDefaultName Default { get; } = new RedisPatchScheduleDefaultName(DefaultValue); - /// Determines if two values are the same. - public static bool operator ==(RedisPatchScheduleDefaultName left, RedisPatchScheduleDefaultName right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RedisPatchScheduleDefaultName left, RedisPatchScheduleDefaultName right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RedisPatchScheduleDefaultName(string value) => new RedisPatchScheduleDefaultName(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RedisPatchScheduleDefaultName other && Equals(other); - /// - public bool Equals(RedisPatchScheduleDefaultName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.Serialization.cs index bcb982505ccc..82aec68d64e0 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.Serialization.cs @@ -8,8 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; using Azure.Core; @@ -36,20 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(RedisPatchScheduleListResult)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -89,17 +84,13 @@ internal static RedisPatchScheduleListResult DeserializeRedisPatchScheduleListRe return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); 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()) { @@ -110,7 +101,11 @@ internal static RedisPatchScheduleListResult DeserializeRedisPatchScheduleListRe } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,68 +114,7 @@ internal static RedisPatchScheduleListResult DeserializeRedisPatchScheduleListRe } } serializedAdditionalRawData = rawDataDictionary; - return new RedisPatchScheduleListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); + return new RedisPatchScheduleListResult(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) @@ -191,8 +125,6 @@ BinaryData IPersistableModel.Write(ModelReaderWrit { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisPatchScheduleListResult)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.cs index f5a4a062b8ad..f3b0b41336d7 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.cs @@ -7,10 +7,11 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Redis.Models { - /// The response of list patch schedules Redis operation. + /// The response of a RedisPatchSchedule list operation. internal partial class RedisPatchScheduleListResult { /// @@ -46,25 +47,34 @@ internal partial class RedisPatchScheduleListResult private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal RedisPatchScheduleListResult() + /// The RedisPatchSchedule items on this page. + /// is null. + internal RedisPatchScheduleListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// Results of the list patch schedules operation. - /// Link for next page of results. + /// The RedisPatchSchedule items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal RedisPatchScheduleListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal RedisPatchScheduleListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Results of the list patch schedules operation. + /// Initializes a new instance of for deserialization. + internal RedisPatchScheduleListResult() + { + } + + /// The RedisPatchSchedule items on this page. public IReadOnlyList Value { get; } - /// Link for next page of results. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.Serialization.cs deleted file mode 100644 index b6a918373ad3..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.Serialization.cs +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Redis.Models -{ - public partial class RedisPatchScheduleSetting : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisPatchScheduleSetting)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("dayOfWeek"u8); - writer.WriteStringValue(DayOfWeek.ToSerialString()); - writer.WritePropertyName("startHourUtc"u8); - writer.WriteNumberValue(StartHourUtc); - if (Optional.IsDefined(MaintenanceWindow)) - { - writer.WritePropertyName("maintenanceWindow"u8); - writer.WriteStringValue(MaintenanceWindow.Value, "P"); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RedisPatchScheduleSetting IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisPatchScheduleSetting)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisPatchScheduleSetting(document.RootElement, options); - } - - internal static RedisPatchScheduleSetting DeserializeRedisPatchScheduleSetting(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - RedisDayOfWeek dayOfWeek = default; - int startHourUtc = default; - TimeSpan? maintenanceWindow = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("dayOfWeek"u8)) - { - dayOfWeek = property.Value.GetString().ToRedisDayOfWeek(); - continue; - } - if (property.NameEquals("startHourUtc"u8)) - { - startHourUtc = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("maintenanceWindow"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - maintenanceWindow = property.Value.GetTimeSpan("P"); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RedisPatchScheduleSetting(dayOfWeek, startHourUtc, maintenanceWindow, serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DayOfWeek), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" dayOfWeek: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" dayOfWeek: "); - builder.AppendLine($"'{DayOfWeek.ToSerialString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartHourUtc), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" startHourUtc: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" startHourUtc: "); - builder.AppendLine($"{StartHourUtc}"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaintenanceWindow), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" maintenanceWindow: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaintenanceWindow)) - { - builder.Append(" maintenanceWindow: "); - var formattedTimeSpan = TypeFormatters.ToString(MaintenanceWindow.Value, "P"); - builder.AppendLine($"'{formattedTimeSpan}'"); - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); - default: - throw new FormatException($"The model {nameof(RedisPatchScheduleSetting)} does not support writing '{options.Format}' format."); - } - } - - RedisPatchScheduleSetting IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisPatchScheduleSetting(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RedisPatchScheduleSetting)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.Serialization.cs index 295ba05d90da..3d195f4f9638 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.Serialization.cs @@ -8,8 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; using Azure.Core; @@ -36,15 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(RedisPrivateEndpointConnectionListResult)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -84,16 +84,13 @@ internal static RedisPrivateEndpointConnectionListResult DeserializeRedisPrivate return null; } IReadOnlyList value = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); 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()) { @@ -102,51 +99,22 @@ internal static RedisPrivateEndpointConnectionListResult DeserializeRedisPrivate value = array; continue; } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new RedisPrivateEndpointConnectionListResult(value ?? new ChangeTrackingList(), serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); + return new RedisPrivateEndpointConnectionListResult(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) @@ -157,8 +125,6 @@ BinaryData IPersistableModel.Write(Mod { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisPrivateEndpointConnectionListResult)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.cs index 12c31080f106..70763a057c05 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.cs @@ -7,10 +7,11 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Redis.Models { - /// List of private endpoint connection associated with the specified storage account. + /// The response of a PrivateEndpointConnection list operation. internal partial class RedisPrivateEndpointConnectionListResult { /// @@ -46,21 +47,34 @@ internal partial class RedisPrivateEndpointConnectionListResult private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal RedisPrivateEndpointConnectionListResult() + /// The PrivateEndpointConnection items on this page. + /// is null. + internal RedisPrivateEndpointConnectionListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// Array of private endpoint connections. + /// The PrivateEndpointConnection items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal RedisPrivateEndpointConnectionListResult(IReadOnlyList value, IDictionary serializedAdditionalRawData) + internal RedisPrivateEndpointConnectionListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; + NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Array of private endpoint connections. + /// Initializes a new instance of for deserialization. + internal RedisPrivateEndpointConnectionListResult() + { + } + + /// The PrivateEndpointConnection items on this page. public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionProvisioningState.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionProvisioningState.cs index d1176b176f09..4cb365495d7d 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionProvisioningState.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionProvisioningState.cs @@ -27,13 +27,13 @@ public RedisPrivateEndpointConnectionProvisioningState(string value) private const string DeletingValue = "Deleting"; private const string FailedValue = "Failed"; - /// Succeeded. + /// Connection has been provisioned. public static RedisPrivateEndpointConnectionProvisioningState Succeeded { get; } = new RedisPrivateEndpointConnectionProvisioningState(SucceededValue); - /// Creating. + /// Connection is being created. public static RedisPrivateEndpointConnectionProvisioningState Creating { get; } = new RedisPrivateEndpointConnectionProvisioningState(CreatingValue); - /// Deleting. + /// Connection is being deleted. public static RedisPrivateEndpointConnectionProvisioningState Deleting { get; } = new RedisPrivateEndpointConnectionProvisioningState(DeletingValue); - /// Failed. + /// Connection provisioning has failed. public static RedisPrivateEndpointConnectionProvisioningState Failed { get; } = new RedisPrivateEndpointConnectionProvisioningState(FailedValue); /// Determines if two values are the same. public static bool operator ==(RedisPrivateEndpointConnectionProvisioningState left, RedisPrivateEndpointConnectionProvisioningState right) => left.Equals(right); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointServiceConnectionStatus.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointServiceConnectionStatus.cs index 613dc71f8ef7..07cdf100adb0 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointServiceConnectionStatus.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointServiceConnectionStatus.cs @@ -26,11 +26,11 @@ public RedisPrivateEndpointServiceConnectionStatus(string value) private const string ApprovedValue = "Approved"; private const string RejectedValue = "Rejected"; - /// Pending. + /// Connection waiting for approval or rejection. public static RedisPrivateEndpointServiceConnectionStatus Pending { get; } = new RedisPrivateEndpointServiceConnectionStatus(PendingValue); - /// Approved. + /// Connection approved. public static RedisPrivateEndpointServiceConnectionStatus Approved { get; } = new RedisPrivateEndpointServiceConnectionStatus(ApprovedValue); - /// Rejected. + /// Connection Rejected. public static RedisPrivateEndpointServiceConnectionStatus Rejected { get; } = new RedisPrivateEndpointServiceConnectionStatus(RejectedValue); /// Determines if two values are the same. public static bool operator ==(RedisPrivateEndpointServiceConnectionStatus left, RedisPrivateEndpointServiceConnectionStatus right) => left.Equals(right); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResource.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResource.Serialization.cs deleted file mode 100644 index aaa0ff879484..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResource.Serialization.cs +++ /dev/null @@ -1,387 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.Redis.Models -{ - public partial class RedisPrivateLinkResource : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisPrivateLinkResource)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(GroupId)) - { - writer.WritePropertyName("groupId"u8); - writer.WriteStringValue(GroupId); - } - if (options.Format != "W" && Optional.IsCollectionDefined(RequiredMembers)) - { - writer.WritePropertyName("requiredMembers"u8); - writer.WriteStartArray(); - foreach (var item in RequiredMembers) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(RequiredZoneNames)) - { - writer.WritePropertyName("requiredZoneNames"u8); - writer.WriteStartArray(); - foreach (var item in RequiredZoneNames) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - } - - RedisPrivateLinkResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisPrivateLinkResource)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisPrivateLinkResource(document.RootElement, options); - } - - internal static RedisPrivateLinkResource DeserializeRedisPrivateLinkResource(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string groupId = default; - IReadOnlyList requiredMembers = default; - IList requiredZoneNames = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - 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 = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerRedisContext.Default); - 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("groupId"u8)) - { - groupId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("requiredMembers"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - requiredMembers = array; - continue; - } - if (property0.NameEquals("requiredZoneNames"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - requiredZoneNames = array; - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RedisPrivateLinkResource( - id, - name, - type, - systemData, - groupId, - requiredMembers ?? new ChangeTrackingList(), - requiredZoneNames ?? new ChangeTrackingList(), - serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Name)) - { - builder.Append(" name: "); - if (Name.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Name}'''"); - } - else - { - builder.AppendLine($"'{Name}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Id)) - { - builder.Append(" id: "); - builder.AppendLine($"'{Id.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" systemData: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SystemData)) - { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); - } - } - - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GroupId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" groupId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(GroupId)) - { - builder.Append(" groupId: "); - if (GroupId.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{GroupId}'''"); - } - else - { - builder.AppendLine($"'{GroupId}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequiredMembers), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" requiredMembers: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(RequiredMembers)) - { - if (RequiredMembers.Any()) - { - builder.Append(" requiredMembers: "); - builder.AppendLine("["); - foreach (var item in RequiredMembers) - { - if (item == null) - { - builder.Append("null"); - continue; - } - if (item.Contains(Environment.NewLine)) - { - builder.AppendLine(" '''"); - builder.AppendLine($"{item}'''"); - } - else - { - builder.AppendLine($" '{item}'"); - } - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequiredZoneNames), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" requiredZoneNames: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(RequiredZoneNames)) - { - if (RequiredZoneNames.Any()) - { - builder.Append(" requiredZoneNames: "); - builder.AppendLine("["); - foreach (var item in RequiredZoneNames) - { - if (item == null) - { - builder.Append("null"); - continue; - } - if (item.Contains(Environment.NewLine)) - { - builder.AppendLine(" '''"); - builder.AppendLine($"{item}'''"); - } - else - { - builder.AppendLine($" '{item}'"); - } - } - builder.AppendLine(" ]"); - } - } - } - - builder.AppendLine(" }"); - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); - default: - throw new FormatException($"The model {nameof(RedisPrivateLinkResource)} does not support writing '{options.Format}' format."); - } - } - - RedisPrivateLinkResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisPrivateLinkResource(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RedisPrivateLinkResource)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceData.Serialization.cs new file mode 100644 index 000000000000..6d3fdc0123a5 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceData.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Redis.Models +{ + public partial class RedisPrivateLinkResourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RedisPrivateLinkResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + RedisPrivateLinkResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RedisPrivateLinkResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRedisPrivateLinkResourceData(document.RootElement, options); + } + + internal static RedisPrivateLinkResourceData DeserializeRedisPrivateLinkResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RedisPrivateLinkResourceProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = RedisPrivateLinkResourceProperties.DeserializeRedisPrivateLinkResourceProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerRedisContext.Default); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RedisPrivateLinkResourceData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + default: + throw new FormatException($"The model {nameof(RedisPrivateLinkResourceData)} does not support writing '{options.Format}' format."); + } + } + + RedisPrivateLinkResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRedisPrivateLinkResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RedisPrivateLinkResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceData.cs similarity index 65% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceData.cs index 0a76a7474871..3e828f6db2e4 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceData.cs @@ -7,11 +7,13 @@ using System; using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Redis.Models { - /// The response of listUpgradeNotifications. - internal partial class RedisUpgradeNotificationListResponse + /// A private link resource. + public partial class RedisPrivateLinkResourceData : ResourceData { /// /// Keeps track of any properties unknown to the library. @@ -45,26 +47,25 @@ internal partial class RedisUpgradeNotificationListResponse /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal RedisUpgradeNotificationListResponse() + /// Initializes a new instance of . + internal RedisPrivateLinkResourceData() { - Value = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// List of all notifications. - /// Link for next set of notifications. + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource properties. /// Keeps track of any properties unknown to the library. - internal RedisUpgradeNotificationListResponse(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal RedisPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, RedisPrivateLinkResourceProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - Value = value; - NextLink = nextLink; + Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of all notifications. - public IReadOnlyList Value { get; } - /// Link for next set of notifications. - public string NextLink { get; } + /// Resource properties. + public RedisPrivateLinkResourceProperties Properties { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.Serialization.cs index 3c7c79ab350e..e0efcf84ec0b 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.Serialization.cs @@ -8,8 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; using Azure.Core; @@ -36,15 +34,17 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(RedisPrivateLinkResourceListResult)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -83,70 +83,38 @@ internal static RedisPrivateLinkResourceListResult DeserializeRedisPrivateLinkRe { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(RedisPrivateLinkResource.DeserializeRedisPrivateLinkResource(item, options)); + array.Add(RedisPrivateLinkResourceData.DeserializeRedisPrivateLinkResourceData(item, options)); } value = array; continue; } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new RedisPrivateLinkResourceListResult(value ?? new ChangeTrackingList(), serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); + return new RedisPrivateLinkResourceListResult(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) @@ -157,8 +125,6 @@ BinaryData IPersistableModel.Write(ModelRead { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisPrivateLinkResourceListResult)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.cs index caff43e1501c..c60d9289acad 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.cs @@ -7,10 +7,11 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.Redis.Models { - /// A list of private link resources. + /// The response of a PrivateLinkResource list operation. internal partial class RedisPrivateLinkResourceListResult { /// @@ -46,21 +47,34 @@ internal partial class RedisPrivateLinkResourceListResult private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal RedisPrivateLinkResourceListResult() + /// The PrivateLinkResource items on this page. + /// is null. + internal RedisPrivateLinkResourceListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } /// Initializes a new instance of . - /// Array of private link resources. + /// The PrivateLinkResource items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal RedisPrivateLinkResourceListResult(IReadOnlyList value, IDictionary serializedAdditionalRawData) + internal RedisPrivateLinkResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; + NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Array of private link resources. - public IReadOnlyList Value { get; } + /// Initializes a new instance of for deserialization. + internal RedisPrivateLinkResourceListResult() + { + } + + /// The PrivateLinkResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceProperties.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceProperties.Serialization.cs new file mode 100644 index 000000000000..9f70aeec0807 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceProperties.Serialization.cs @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Redis.Models +{ + public partial class RedisPrivateLinkResourceProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RedisPrivateLinkResourceProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(GroupId)) + { + writer.WritePropertyName("groupId"u8); + writer.WriteStringValue(GroupId); + } + if (options.Format != "W" && Optional.IsCollectionDefined(RequiredMembers)) + { + writer.WritePropertyName("requiredMembers"u8); + writer.WriteStartArray(); + foreach (var item in RequiredMembers) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RequiredZoneNames)) + { + writer.WritePropertyName("requiredZoneNames"u8); + writer.WriteStartArray(); + foreach (var item in RequiredZoneNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RedisPrivateLinkResourceProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RedisPrivateLinkResourceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRedisPrivateLinkResourceProperties(document.RootElement, options); + } + + internal static RedisPrivateLinkResourceProperties DeserializeRedisPrivateLinkResourceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string groupId = default; + IReadOnlyList requiredMembers = default; + IReadOnlyList requiredZoneNames = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("groupId"u8)) + { + groupId = property.Value.GetString(); + continue; + } + if (property.NameEquals("requiredMembers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + requiredMembers = array; + continue; + } + if (property.NameEquals("requiredZoneNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + requiredZoneNames = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RedisPrivateLinkResourceProperties(groupId, requiredMembers ?? new ChangeTrackingList(), requiredZoneNames ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + default: + throw new FormatException($"The model {nameof(RedisPrivateLinkResourceProperties)} does not support writing '{options.Format}' format."); + } + } + + RedisPrivateLinkResourceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRedisPrivateLinkResourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RedisPrivateLinkResourceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceProperties.cs similarity index 70% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResource.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceProperties.cs index d8310d80b221..80ab1d38e4ea 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceProperties.cs @@ -7,13 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Redis.Models { - /// A private link resource. - public partial class RedisPrivateLinkResource : ResourceData + /// Properties of a private link resource. + public partial class RedisPrivateLinkResourceProperties { /// /// Keeps track of any properties unknown to the library. @@ -47,23 +45,19 @@ public partial class RedisPrivateLinkResource : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public RedisPrivateLinkResource() + /// Initializes a new instance of . + internal RedisPrivateLinkResourceProperties() { RequiredMembers = new ChangeTrackingList(); RequiredZoneNames = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. + /// Initializes a new instance of . /// The private link resource group id. /// The private link resource required member names. - /// The private link resource Private link DNS zone name. + /// The private link resource private link DNS zone name. /// Keeps track of any properties unknown to the library. - internal RedisPrivateLinkResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal RedisPrivateLinkResourceProperties(string groupId, IReadOnlyList requiredMembers, IReadOnlyList requiredZoneNames, IDictionary serializedAdditionalRawData) { GroupId = groupId; RequiredMembers = requiredMembers; @@ -72,13 +66,10 @@ internal RedisPrivateLinkResource(ResourceIdentifier id, string name, ResourceTy } /// The private link resource group id. - [WirePath("properties.groupId")] public string GroupId { get; } /// The private link resource required member names. - [WirePath("properties.requiredMembers")] public IReadOnlyList RequiredMembers { get; } - /// The private link resource Private link DNS zone name. - [WirePath("properties.requiredZoneNames")] - public IList RequiredZoneNames { get; } + /// The private link resource private link DNS zone name. + public IReadOnlyList RequiredZoneNames { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.Serialization.cs index beee2a87bd27..24dcdb0d55ea 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.Serialization.cs @@ -8,7 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; using Azure.Core; @@ -122,82 +121,6 @@ internal static RedisPrivateLinkServiceConnectionState DeserializeRedisPrivateLi return new RedisPrivateLinkServiceConnectionState(status, description, actionsRequired, serializedAdditionalRawData); } - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" status: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Status)) - { - builder.Append(" status: "); - builder.AppendLine($"'{Status.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Description), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" description: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Description)) - { - builder.Append(" description: "); - if (Description.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Description}'''"); - } - else - { - builder.AppendLine($"'{Description}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ActionsRequired), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" actionsRequired: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ActionsRequired)) - { - builder.Append(" actionsRequired: "); - if (ActionsRequired.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ActionsRequired}'''"); - } - else - { - builder.AppendLine($"'{ActionsRequired}'"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -206,8 +129,6 @@ BinaryData IPersistableModel.Write(Model { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisPrivateLinkServiceConnectionState)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.cs index 8aeaf7cb82e1..d091f26384de 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.cs @@ -64,13 +64,10 @@ internal RedisPrivateLinkServiceConnectionState(RedisPrivateEndpointServiceConne } /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. - [WirePath("status")] public RedisPrivateEndpointServiceConnectionStatus? Status { get; set; } /// The reason for approval/rejection of the connection. - [WirePath("description")] public string Description { get; set; } /// A message indicating if changes on the service provider require any updates on the consumer. - [WirePath("actionsRequired")] public string ActionsRequired { 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 deleted file mode 100644 index 2893aa942ddf..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisProvisioningState.cs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Redis.Models -{ - /// Redis instance provisioning status. - public readonly partial struct RedisProvisioningState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RedisProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string CreatingValue = "Creating"; - private const string DeletingValue = "Deleting"; - private const string DisabledValue = "Disabled"; - private const string FailedValue = "Failed"; - private const string LinkingValue = "Linking"; - private const string ProvisioningValue = "Provisioning"; - private const string RecoveringScaleFailureValue = "RecoveringScaleFailure"; - private const string ScalingValue = "Scaling"; - private const string SucceededValue = "Succeeded"; - 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); - /// Deleting. - public static RedisProvisioningState Deleting { get; } = new RedisProvisioningState(DeletingValue); - /// Disabled. - public static RedisProvisioningState Disabled { get; } = new RedisProvisioningState(DisabledValue); - /// Failed. - public static RedisProvisioningState Failed { get; } = new RedisProvisioningState(FailedValue); - /// Linking. - public static RedisProvisioningState Linking { get; } = new RedisProvisioningState(LinkingValue); - /// Provisioning. - public static RedisProvisioningState Provisioning { get; } = new RedisProvisioningState(ProvisioningValue); - /// RecoveringScaleFailure. - public static RedisProvisioningState RecoveringScaleFailure { get; } = new RedisProvisioningState(RecoveringScaleFailureValue); - /// Scaling. - public static RedisProvisioningState Scaling { get; } = new RedisProvisioningState(ScalingValue); - /// Succeeded. - public static RedisProvisioningState Succeeded { get; } = new RedisProvisioningState(SucceededValue); - /// Unlinking. - public static RedisProvisioningState Unlinking { get; } = new RedisProvisioningState(UnlinkingValue); - /// Unprovisioning. - 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. - public static bool operator !=(RedisProvisioningState left, RedisProvisioningState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RedisProvisioningState(string value) => new RedisProvisioningState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RedisProvisioningState other && Equals(other); - /// - public bool Equals(RedisProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPublicNetworkAccess.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPublicNetworkAccess.cs deleted file mode 100644 index 9e57ad519b80..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPublicNetworkAccess.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Redis.Models -{ - /// 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 readonly partial struct RedisPublicNetworkAccess : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RedisPublicNetworkAccess(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; - - /// Enabled. - public static RedisPublicNetworkAccess Enabled { get; } = new RedisPublicNetworkAccess(EnabledValue); - /// Disabled. - public static RedisPublicNetworkAccess Disabled { get; } = new RedisPublicNetworkAccess(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(RedisPublicNetworkAccess left, RedisPublicNetworkAccess right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RedisPublicNetworkAccess left, RedisPublicNetworkAccess right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RedisPublicNetworkAccess(string value) => new RedisPublicNetworkAccess(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RedisPublicNetworkAccess other && Equals(other); - /// - public bool Equals(RedisPublicNetworkAccess other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.Serialization.cs index 82cb85273c17..23a65b5159d9 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.Serialization.cs @@ -91,7 +91,7 @@ internal static RedisRebootContent DeserializeRedisRebootContent(JsonElement ele { return null; } - RedisRebootType? rebootType = default; + RebootType? rebootType = default; int? shardId = default; IList ports = default; IDictionary serializedAdditionalRawData = default; @@ -104,7 +104,7 @@ internal static RedisRebootContent DeserializeRedisRebootContent(JsonElement ele { continue; } - rebootType = new RedisRebootType(property.Value.GetString()); + rebootType = new RebootType(property.Value.GetString()); continue; } if (property.NameEquals("shardId"u8)) diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.cs index ca7161b22844..fd5f73566052 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.cs @@ -56,7 +56,7 @@ public RedisRebootContent() /// If clustering is enabled, the ID of the shard to be rebooted. /// A list of redis instances to reboot, specified by per-instance SSL ports or non-SSL ports. /// Keeps track of any properties unknown to the library. - internal RedisRebootContent(RedisRebootType? rebootType, int? shardId, IList ports, IDictionary serializedAdditionalRawData) + internal RedisRebootContent(RebootType? rebootType, int? shardId, IList ports, IDictionary serializedAdditionalRawData) { RebootType = rebootType; ShardId = shardId; @@ -65,13 +65,10 @@ internal RedisRebootContent(RedisRebootType? rebootType, int? shardId, IList Which Redis node(s) to reboot. Depending on this value data loss is possible. - [WirePath("rebootType")] - public RedisRebootType? RebootType { get; set; } + public RebootType? RebootType { get; set; } /// If clustering is enabled, the ID of the shard to be rebooted. - [WirePath("shardId")] public int? ShardId { get; set; } /// A list of redis instances to reboot, specified by per-instance SSL ports or non-SSL ports. - [WirePath("ports")] public IList Ports { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootType.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootType.cs deleted file mode 100644 index c970928a8eac..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootType.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Redis.Models -{ - /// Which Redis node(s) to reboot. Depending on this value data loss is possible. - public readonly partial struct RedisRebootType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RedisRebootType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string PrimaryNodeValue = "PrimaryNode"; - private const string SecondaryNodeValue = "SecondaryNode"; - private const string AllNodesValue = "AllNodes"; - - /// PrimaryNode. - public static RedisRebootType PrimaryNode { get; } = new RedisRebootType(PrimaryNodeValue); - /// SecondaryNode. - public static RedisRebootType SecondaryNode { get; } = new RedisRebootType(SecondaryNodeValue); - /// AllNodes. - public static RedisRebootType AllNodes { get; } = new RedisRebootType(AllNodesValue); - /// Determines if two values are the same. - public static bool operator ==(RedisRebootType left, RedisRebootType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RedisRebootType left, RedisRebootType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RedisRebootType(string value) => new RedisRebootType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RedisRebootType other && Equals(other); - /// - public bool Equals(RedisRebootType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.Serialization.cs index abfb5ce33b98..5a9c53476476 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.Serialization.cs @@ -73,14 +73,14 @@ internal static RedisRegenerateKeyContent DeserializeRedisRegenerateKeyContent(J { return null; } - RedisRegenerateKeyType keyType = default; + RedisKeyType keyType = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyType"u8)) { - keyType = property.Value.GetString().ToRedisRegenerateKeyType(); + keyType = property.Value.GetString().ToRedisKeyType(); continue; } if (options.Format != "W") diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.cs index 3feae7bd6f68..f255e014300f 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.cs @@ -47,7 +47,7 @@ public partial class RedisRegenerateKeyContent /// Initializes a new instance of . /// The Redis access key to regenerate. - public RedisRegenerateKeyContent(RedisRegenerateKeyType keyType) + public RedisRegenerateKeyContent(RedisKeyType keyType) { KeyType = keyType; } @@ -55,7 +55,7 @@ public RedisRegenerateKeyContent(RedisRegenerateKeyType keyType) /// Initializes a new instance of . /// The Redis access key to regenerate. /// Keeps track of any properties unknown to the library. - internal RedisRegenerateKeyContent(RedisRegenerateKeyType keyType, IDictionary serializedAdditionalRawData) + internal RedisRegenerateKeyContent(RedisKeyType keyType, IDictionary serializedAdditionalRawData) { KeyType = keyType; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -67,7 +67,6 @@ internal RedisRegenerateKeyContent() } /// The Redis access key to regenerate. - [WirePath("keyType")] - public RedisRegenerateKeyType KeyType { get; } + public RedisKeyType KeyType { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyType.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyType.Serialization.cs deleted file mode 100644 index ac9e806c38a0..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyType.Serialization.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Redis.Models -{ - internal static partial class RedisRegenerateKeyTypeExtensions - { - public static string ToSerialString(this RedisRegenerateKeyType value) => value switch - { - RedisRegenerateKeyType.Primary => "Primary", - RedisRegenerateKeyType.Secondary => "Secondary", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisRegenerateKeyType value.") - }; - - public static RedisRegenerateKeyType ToRedisRegenerateKeyType(this string value) - { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Primary")) return RedisRegenerateKeyType.Primary; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Secondary")) return RedisRegenerateKeyType.Secondary; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisRegenerateKeyType value."); - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourceCreateOrUpdateContent.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourceCreateOrUpdateContent.Serialization.cs new file mode 100644 index 000000000000..10ad76311f14 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourceCreateOrUpdateContent.Serialization.cs @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Redis.Models +{ + public partial class RedisResourceCreateOrUpdateContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RedisResourceCreateOrUpdateContent)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Zones)) + { + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (var item in Zones) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + ((IJsonModel)Identity).Write(writer, ModelSerializationExtensions.WireV3Options); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + if (Optional.IsDefined(SubnetId)) + { + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); + } + if (Optional.IsDefined(StaticIP)) + { + writer.WritePropertyName("staticIP"u8); + writer.WriteStringValue(StaticIP); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RedisResourceCreateOrUpdateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RedisResourceCreateOrUpdateContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRedisResourceCreateOrUpdateContent(document.RootElement, options); + } + + internal static RedisResourceCreateOrUpdateContent DeserializeRedisResourceCreateOrUpdateContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList zones = default; + string location = default; + IDictionary tags = default; + ManagedServiceIdentity identity = default; + RedisSku sku = default; + string subnetId = default; + string staticIP = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("zones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + zones = array; + continue; + } + if (property.NameEquals("location"u8)) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireV3Options, AzureResourceManagerRedisContext.Default); + 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("sku"u8)) + { + sku = RedisSku.DeserializeRedisSku(property0.Value, options); + continue; + } + if (property0.NameEquals("subnetId"u8)) + { + subnetId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("staticIP"u8)) + { + staticIP = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RedisResourceCreateOrUpdateContent( + sku, + subnetId, + staticIP, + zones ?? new ChangeTrackingList(), + location, + tags ?? new ChangeTrackingDictionary(), + identity, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + default: + throw new FormatException($"The model {nameof(RedisResourceCreateOrUpdateContent)} does not support writing '{options.Format}' format."); + } + } + + RedisResourceCreateOrUpdateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRedisResourceCreateOrUpdateContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RedisResourceCreateOrUpdateContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourceCreateOrUpdateContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourceCreateOrUpdateContent.cs new file mode 100644 index 000000000000..b4755ede8b9e --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourceCreateOrUpdateContent.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Redis.Models +{ + /// Parameters supplied to the Create Redis operation. + public partial class RedisResourceCreateOrUpdateContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The SKU of the Redis cache to deploy. + /// The geo-location where the resource lives. + /// or is null. + public RedisResourceCreateOrUpdateContent(RedisSku sku, string location) + { + Argument.AssertNotNull(sku, nameof(sku)); + Argument.AssertNotNull(location, nameof(location)); + + Sku = sku; + Zones = new ChangeTrackingList(); + Location = location; + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// 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. + /// A list of availability zones denoting where the resource needs to come from. + /// The geo-location where the resource lives. + /// Resource tags. + /// The identity of the resource. + /// Keeps track of any properties unknown to the library. + internal RedisResourceCreateOrUpdateContent(RedisSku sku, string subnetId, string staticIP, IList zones, string location, IDictionary tags, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) + { + Sku = sku; + SubnetId = subnetId; + StaticIP = staticIP; + Zones = zones; + Location = location; + Tags = tags; + Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RedisResourceCreateOrUpdateContent() + { + } + + /// 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. + public string SubnetId { get; set; } + /// Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. + public string StaticIP { get; set; } + /// A list of availability zones denoting where the resource needs to come from. + public IList Zones { get; } + /// The geo-location where the resource lives. + public string Location { get; } + /// Resource tags. + public IDictionary Tags { get; } + /// The identity of the resource. + public ManagedServiceIdentity Identity { get; set; } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourcePatch.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourcePatch.Serialization.cs new file mode 100644 index 000000000000..875c7355c974 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourcePatch.Serialization.cs @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Redis.Models +{ + public partial class RedisResourcePatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RedisResourcePatch)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + ((IJsonModel)Identity).Write(writer, ModelSerializationExtensions.WireV3Options); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RedisResourcePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RedisResourcePatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRedisResourcePatch(document.RootElement, options); + } + + internal static RedisResourcePatch DeserializeRedisResourcePatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + ManagedServiceIdentity identity = default; + RedisSku sku = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireV3Options, AzureResourceManagerRedisContext.Default); + 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("sku"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = RedisSku.DeserializeRedisSku(property0.Value, options); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RedisResourcePatch(sku, tags ?? new ChangeTrackingDictionary(), identity, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + default: + throw new FormatException($"The model {nameof(RedisResourcePatch)} does not support writing '{options.Format}' format."); + } + } + + RedisResourcePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRedisResourcePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RedisResourcePatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourcePatch.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourcePatch.cs new file mode 100644 index 000000000000..b26fdb129686 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourcePatch.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Redis.Models +{ + /// Parameters supplied to the Update Redis operation. + public partial class RedisResourcePatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RedisResourcePatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The SKU of the Redis cache to deploy. + /// Resource tags. + /// The identity of the resource. + /// Keeps track of any properties unknown to the library. + internal RedisResourcePatch(RedisSku sku, IDictionary tags, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) + { + Sku = sku; + Tags = tags; + Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The SKU of the Redis cache to deploy. + public RedisSku Sku { get; set; } + /// Resource tags. + public IDictionary Tags { get; } + /// The identity of the resource. + public ManagedServiceIdentity Identity { get; set; } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.Serialization.cs index f3ac1ad0883c..4d7fba216cc5 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.Serialization.cs @@ -8,7 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Text; using System.Text.Json; using Azure.Core; @@ -109,57 +108,6 @@ internal static RedisSku DeserializeRedisSku(JsonElement element, ModelReaderWri return new RedisSku(name, family, capacity, serializedAdditionalRawData); } - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" name: "); - builder.AppendLine($"'{Name.ToString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Family), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" family: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" family: "); - builder.AppendLine($"'{Family.ToString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Capacity), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" capacity: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" capacity: "); - builder.AppendLine($"{Capacity}"); - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -168,8 +116,6 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisSku)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.cs index 9560be2052dd..0fd4ddbc9cb5 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.cs @@ -75,13 +75,10 @@ internal RedisSku() } /// The type of Redis cache to deploy. Valid values: (Basic, Standard, Premium). - [WirePath("name")] public RedisSkuName Name { get; set; } /// The SKU family to use. Valid values: (C, P). (C = Basic/Standard, P = Premium). - [WirePath("family")] public RedisSkuFamily Family { get; set; } /// The size of the Redis cache to deploy. Valid values: for C (Basic/Standard) family (0, 1, 2, 3, 4, 5, 6), for P (Premium) family (1, 2, 3, 4). - [WirePath("capacity")] public int Capacity { get; set; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSkuFamily.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSkuFamily.cs index efe21ff42084..5b0f3410fa13 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSkuFamily.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSkuFamily.cs @@ -22,13 +22,13 @@ public RedisSkuFamily(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string BasicOrStandardValue = "C"; - private const string PremiumValue = "P"; + private const string CValue = "C"; + private const string PValue = "P"; - /// C. - public static RedisSkuFamily BasicOrStandard { get; } = new RedisSkuFamily(BasicOrStandardValue); - /// P. - public static RedisSkuFamily Premium { get; } = new RedisSkuFamily(PremiumValue); + /// The SKU family to use - must be 'C' for Basic/Standard SKU redis caches. *. + public static RedisSkuFamily C { get; } = new RedisSkuFamily(CValue); + /// The SKU family to use - must be 'P' for Premium SKU redis caches. *. + public static RedisSkuFamily P { get; } = new RedisSkuFamily(PValue); /// Determines if two values are the same. public static bool operator ==(RedisSkuFamily left, RedisSkuFamily right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSkuName.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSkuName.cs index ed28e91bc86f..64f6a7635000 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSkuName.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSkuName.cs @@ -26,11 +26,11 @@ public RedisSkuName(string value) private const string StandardValue = "Standard"; private const string PremiumValue = "Premium"; - /// Basic. + /// The well known 'Basic' SKU for Azure Cache for Redis. Basic SKU does not have an availability SLA. *. public static RedisSkuName Basic { get; } = new RedisSkuName(BasicValue); - /// Standard. + /// The well known 'Standard' SKU for Azure Cache for Redis. Standard SKU has an availability SLA. *. public static RedisSkuName Standard { get; } = new RedisSkuName(StandardValue); - /// Premium. + /// The well known 'Premium' SKU for Azure Cache for Redis. Premium SKU has an availability SLA, and higher performance tiers and more features compared with Standard SKU. *. public static RedisSkuName Premium { get; } = new RedisSkuName(PremiumValue); /// Determines if two values are the same. public static bool operator ==(RedisSkuName left, RedisSkuName right) => left.Equals(right); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisTlsVersion.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisTlsVersion.cs deleted file mode 100644 index b4762a3086c7..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisTlsVersion.cs +++ /dev/null @@ -1,47 +0,0 @@ -// 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: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). - public readonly partial struct RedisTlsVersion : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public RedisTlsVersion(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string Tls1_0Value = "1.0"; - private const string Tls1_1Value = "1.1"; - private const string Tls1_2Value = "1.2"; - /// Determines if two values are the same. - public static bool operator ==(RedisTlsVersion left, RedisTlsVersion right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RedisTlsVersion left, RedisTlsVersion right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RedisTlsVersion(string value) => new RedisTlsVersion(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RedisTlsVersion other && Equals(other); - /// - public bool Equals(RedisTlsVersion other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.Serialization.cs deleted file mode 100644 index c09706ee592a..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.Serialization.cs +++ /dev/null @@ -1,265 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Redis.Models -{ - public partial class RedisUpgradeNotification : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisUpgradeNotification)} does not support writing '{format}' format."); - } - - if (options.Format != "W" && Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W" && Optional.IsDefined(Timestamp)) - { - writer.WritePropertyName("timestamp"u8); - writer.WriteStringValue(Timestamp.Value, "O"); - } - if (options.Format != "W" && Optional.IsCollectionDefined(UpsellNotification)) - { - writer.WritePropertyName("upsellNotification"u8); - writer.WriteStartObject(); - foreach (var item in UpsellNotification) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RedisUpgradeNotification IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisUpgradeNotification)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisUpgradeNotification(document.RootElement, options); - } - - internal static RedisUpgradeNotification DeserializeRedisUpgradeNotification(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - DateTimeOffset? timestamp = default; - IReadOnlyDictionary upsellNotification = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("timestamp"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - timestamp = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("upsellNotification"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - upsellNotification = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RedisUpgradeNotification(name, timestamp, upsellNotification ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Name)) - { - builder.Append(" name: "); - if (Name.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Name}'''"); - } - else - { - builder.AppendLine($"'{Name}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Timestamp), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" timestamp: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Timestamp)) - { - builder.Append(" timestamp: "); - var formattedDateTimeString = TypeFormatters.ToString(Timestamp.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UpsellNotification), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" upsellNotification: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(UpsellNotification)) - { - if (UpsellNotification.Any()) - { - builder.Append(" upsellNotification: "); - builder.AppendLine("{"); - foreach (var item in UpsellNotification) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - if (item.Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{item.Value}'''"); - } - else - { - builder.AppendLine($"'{item.Value}'"); - } - } - builder.AppendLine(" }"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); - default: - throw new FormatException($"The model {nameof(RedisUpgradeNotification)} does not support writing '{options.Format}' format."); - } - } - - RedisUpgradeNotification IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisUpgradeNotification(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RedisUpgradeNotification)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.Serialization.cs deleted file mode 100644 index 4c83388529a0..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.Serialization.cs +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Redis.Models -{ - internal partial class RedisUpgradeNotificationListResponse : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisUpgradeNotificationListResponse)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Value)) - { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(NextLink)) - { - writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - RedisUpgradeNotificationListResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisUpgradeNotificationListResponse)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisUpgradeNotificationListResponse(document.RootElement, options); - } - - internal static RedisUpgradeNotificationListResponse DeserializeRedisUpgradeNotificationListResponse(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - 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(RedisUpgradeNotification.DeserializeRedisUpgradeNotification(item, options)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RedisUpgradeNotificationListResponse(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" value: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Value)) - { - if (Value.Any()) - { - builder.Append(" value: "); - builder.AppendLine("["); - foreach (var item in Value) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nextLink: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NextLink)) - { - builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } - } - } - - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); - default: - throw new FormatException($"The model {nameof(RedisUpgradeNotificationListResponse)} does not support writing '{options.Format}' format."); - } - } - - RedisUpgradeNotificationListResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisUpgradeNotificationListResponse(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RedisUpgradeNotificationListResponse)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ReplicationRole.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ReplicationRole.Serialization.cs new file mode 100644 index 000000000000..5934eb414997 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ReplicationRole.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Redis.Models +{ + internal static partial class ReplicationRoleExtensions + { + public static string ToSerialString(this ReplicationRole value) => value switch + { + ReplicationRole.Primary => "Primary", + ReplicationRole.Secondary => "Secondary", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ReplicationRole value.") + }; + + public static ReplicationRole ToReplicationRole(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Primary")) return ReplicationRole.Primary; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Secondary")) return ReplicationRole.Secondary; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ReplicationRole value."); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerRole.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ReplicationRole.cs similarity index 58% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerRole.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ReplicationRole.cs index f524a6571a5b..ef4023d3ffbc 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerRole.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ReplicationRole.cs @@ -8,11 +8,11 @@ namespace Azure.ResourceManager.Redis.Models { /// Role of the linked server. - public enum RedisLinkedServerRole + public enum ReplicationRole { - /// Primary. + /// The linked server is in the writable primary role *. Primary, - /// Secondary. + /// The linked server is in the read-only replica role *. Secondary } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ScheduleEntry.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ScheduleEntry.Serialization.cs new file mode 100644 index 000000000000..87598fbe4d7b --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ScheduleEntry.Serialization.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Redis.Models +{ + public partial class ScheduleEntry : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ScheduleEntry)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("dayOfWeek"u8); + writer.WriteStringValue(DayOfWeek.ToSerialString()); + writer.WritePropertyName("startHourUtc"u8); + writer.WriteNumberValue(StartHourUtc); + if (Optional.IsDefined(MaintenanceWindow)) + { + writer.WritePropertyName("maintenanceWindow"u8); + writer.WriteStringValue(MaintenanceWindow.Value, "P"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ScheduleEntry IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ScheduleEntry)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScheduleEntry(document.RootElement, options); + } + + internal static ScheduleEntry DeserializeScheduleEntry(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DayOfWeek dayOfWeek = default; + int startHourUtc = default; + TimeSpan? maintenanceWindow = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dayOfWeek"u8)) + { + dayOfWeek = property.Value.GetString().ToDayOfWeek(); + continue; + } + if (property.NameEquals("startHourUtc"u8)) + { + startHourUtc = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maintenanceWindow"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maintenanceWindow = property.Value.GetTimeSpan("P"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ScheduleEntry(dayOfWeek, startHourUtc, maintenanceWindow, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + default: + throw new FormatException($"The model {nameof(ScheduleEntry)} does not support writing '{options.Format}' format."); + } + } + + ScheduleEntry IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeScheduleEntry(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScheduleEntry)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ScheduleEntry.cs similarity index 77% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ScheduleEntry.cs index 5d77f24cacb7..5c8da2369572 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ScheduleEntry.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Patch schedule entry for a Premium Redis Cache. - public partial class RedisPatchScheduleSetting + public partial class ScheduleEntry { /// /// Keeps track of any properties unknown to the library. @@ -45,21 +45,21 @@ public partial class RedisPatchScheduleSetting /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Day of the week when a cache can be patched. /// Start hour after which cache patching can start. - public RedisPatchScheduleSetting(RedisDayOfWeek dayOfWeek, int startHourUtc) + public ScheduleEntry(DayOfWeek dayOfWeek, int startHourUtc) { DayOfWeek = dayOfWeek; StartHourUtc = startHourUtc; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Day of the week when a cache can be patched. /// Start hour after which cache patching can start. /// ISO8601 timespan specifying how much time cache patching can take. /// Keeps track of any properties unknown to the library. - internal RedisPatchScheduleSetting(RedisDayOfWeek dayOfWeek, int startHourUtc, TimeSpan? maintenanceWindow, IDictionary serializedAdditionalRawData) + internal ScheduleEntry(DayOfWeek dayOfWeek, int startHourUtc, TimeSpan? maintenanceWindow, IDictionary serializedAdditionalRawData) { DayOfWeek = dayOfWeek; StartHourUtc = startHourUtc; @@ -67,19 +67,16 @@ internal RedisPatchScheduleSetting(RedisDayOfWeek dayOfWeek, int startHourUtc, T _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal RedisPatchScheduleSetting() + /// Initializes a new instance of for deserialization. + internal ScheduleEntry() { } /// Day of the week when a cache can be patched. - [WirePath("dayOfWeek")] - public RedisDayOfWeek DayOfWeek { get; set; } + public DayOfWeek DayOfWeek { get; set; } /// Start hour after which cache patching can start. - [WirePath("startHourUtc")] public int StartHourUtc { get; set; } /// ISO8601 timespan specifying how much time cache patching can take. - [WirePath("maintenanceWindow")] public TimeSpan? MaintenanceWindow { get; set; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpdateChannel.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpdateChannel.cs deleted file mode 100644 index d10961e68717..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpdateChannel.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 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 != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpgradeNotification.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpgradeNotification.Serialization.cs new file mode 100644 index 000000000000..957385612a05 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpgradeNotification.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Redis.Models +{ + public partial class UpgradeNotification : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpgradeNotification)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(Timestamp)) + { + writer.WritePropertyName("timestamp"u8); + writer.WriteStringValue(Timestamp.Value, "O"); + } + if (options.Format != "W" && Optional.IsCollectionDefined(UpsellNotification)) + { + writer.WritePropertyName("upsellNotification"u8); + writer.WriteStartObject(); + foreach (var item in UpsellNotification) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + UpgradeNotification IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpgradeNotification)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUpgradeNotification(document.RootElement, options); + } + + internal static UpgradeNotification DeserializeUpgradeNotification(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + DateTimeOffset? timestamp = default; + IReadOnlyDictionary upsellNotification = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("timestamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("upsellNotification"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + upsellNotification = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UpgradeNotification(name, timestamp, upsellNotification ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + default: + throw new FormatException($"The model {nameof(UpgradeNotification)} does not support writing '{options.Format}' format."); + } + } + + UpgradeNotification IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpgradeNotification(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UpgradeNotification)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpgradeNotification.cs similarity index 82% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpgradeNotification.cs index 33b1941d27a0..613f4457f78c 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpgradeNotification.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Properties of upgrade notification. - public partial class RedisUpgradeNotification + public partial class UpgradeNotification { /// /// Keeps track of any properties unknown to the library. @@ -45,18 +45,18 @@ public partial class RedisUpgradeNotification /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal RedisUpgradeNotification() + /// Initializes a new instance of . + internal UpgradeNotification() { UpsellNotification = new ChangeTrackingDictionary(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Name of upgrade notification. /// Timestamp when upgrade notification occurred. /// Details about this upgrade notification. /// Keeps track of any properties unknown to the library. - internal RedisUpgradeNotification(string name, DateTimeOffset? timestamp, IReadOnlyDictionary upsellNotification, IDictionary serializedAdditionalRawData) + internal UpgradeNotification(string name, DateTimeOffset? timestamp, IReadOnlyDictionary upsellNotification, IDictionary serializedAdditionalRawData) { Name = name; Timestamp = timestamp; @@ -65,13 +65,10 @@ internal RedisUpgradeNotification(string name, DateTimeOffset? timestamp, IReadO } /// Name of upgrade notification. - [WirePath("name")] public string Name { get; } /// Timestamp when upgrade notification occurred. - [WirePath("timestamp")] public DateTimeOffset? Timestamp { get; } /// Details about this upgrade notification. - [WirePath("upsellNotification")] public IReadOnlyDictionary UpsellNotification { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ZonalAllocationPolicy.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ZonalAllocationPolicy.cs deleted file mode 100644 index a2a99e3ba8d1..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ZonalAllocationPolicy.cs +++ /dev/null @@ -1,54 +0,0 @@ -// 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 how availability zones are allocated to the Redis cache. 'Automatic' enables zone redundancy and Azure will automatically select zones based on regional availability and capacity. 'UserDefined' will select availability zones passed in by you using the 'zones' parameter. 'NoZones' will produce a non-zonal cache. If 'zonalAllocationPolicy' is not passed, it will be set to 'UserDefined' when zones are passed in, otherwise, it will be set to 'Automatic' in regions where zones are supported and 'NoZones' in regions where zones are not supported. - public readonly partial struct ZonalAllocationPolicy : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ZonalAllocationPolicy(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AutomaticValue = "Automatic"; - private const string UserDefinedValue = "UserDefined"; - private const string NoZonesValue = "NoZones"; - - /// Automatic. - public static ZonalAllocationPolicy Automatic { get; } = new ZonalAllocationPolicy(AutomaticValue); - /// UserDefined. - public static ZonalAllocationPolicy UserDefined { get; } = new ZonalAllocationPolicy(UserDefinedValue); - /// NoZones. - public static ZonalAllocationPolicy NoZones { get; } = new ZonalAllocationPolicy(NoZonesValue); - /// Determines if two values are the same. - public static bool operator ==(ZonalAllocationPolicy left, ZonalAllocationPolicy right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ZonalAllocationPolicy left, ZonalAllocationPolicy right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ZonalAllocationPolicy(string value) => new ZonalAllocationPolicy(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ZonalAllocationPolicy other && Equals(other); - /// - public bool Equals(ZonalAllocationPolicy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 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 index c0029f2408d9..a9e2504b361d 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentCollection.cs @@ -24,8 +24,8 @@ namespace Azure.ResourceManager.Redis /// public partial class RedisCacheAccessPolicyAssignmentCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics; - private readonly AccessPolicyAssignmentRestOperations _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient; + private readonly ClientDiagnostics _redisCacheAccessPolicyAssignmentClientDiagnostics; + private readonly RedisCacheAccessPolicyAssignmentsRestOperations _redisCacheAccessPolicyAssignmentRestClient; /// Initializes a new instance of the class for mocking. protected RedisCacheAccessPolicyAssignmentCollection() @@ -37,9 +37,9 @@ protected RedisCacheAccessPolicyAssignmentCollection() /// 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); + _redisCacheAccessPolicyAssignmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", RedisCacheAccessPolicyAssignmentResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(RedisCacheAccessPolicyAssignmentResource.ResourceType, out string redisCacheAccessPolicyAssignmentApiVersion); + _redisCacheAccessPolicyAssignmentRestClient = new RedisCacheAccessPolicyAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisCacheAccessPolicyAssignmentApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -60,7 +60,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// AccessPolicyAssignment_CreateUpdate + /// RedisCacheAccessPolicyAssignment_CreateUpdate /// /// /// Default Api Version @@ -83,12 +83,12 @@ public virtual async Task Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.CreateOrUpdate"); + using var scope = _redisCacheAccessPolicyAssignmentClientDiagnostics.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); + var response = await _redisCacheAccessPolicyAssignmentRestClient.CreateUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, data, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyAssignmentOperationSource(Client), _redisCacheAccessPolicyAssignmentClientDiagnostics, Pipeline, _redisCacheAccessPolicyAssignmentRestClient.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; @@ -109,7 +109,7 @@ public virtual async Task /// /// /// Operation Id - /// AccessPolicyAssignment_CreateUpdate + /// RedisCacheAccessPolicyAssignment_CreateUpdate /// /// /// Default Api Version @@ -132,12 +132,12 @@ public virtual ArmOperation CreateOrUp Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.CreateOrUpdate"); + using var scope = _redisCacheAccessPolicyAssignmentClientDiagnostics.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); + var response = _redisCacheAccessPolicyAssignmentRestClient.CreateUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, data, cancellationToken); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyAssignmentOperationSource(Client), _redisCacheAccessPolicyAssignmentClientDiagnostics, Pipeline, _redisCacheAccessPolicyAssignmentRestClient.CreateCreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -158,7 +158,7 @@ public virtual ArmOperation CreateOrUp /// /// /// Operation Id - /// AccessPolicyAssignment_Get + /// RedisCacheAccessPolicyAssignment_Get /// /// /// Default Api Version @@ -178,11 +178,11 @@ public virtual async Task> Ge { Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); - using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.Get"); + using var scope = _redisCacheAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.Get"); scope.Start(); try { - var response = await _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, cancellationToken).ConfigureAwait(false); + var response = await _redisCacheAccessPolicyAssignmentRestClient.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()); @@ -203,7 +203,7 @@ public virtual async Task> Ge /// /// /// Operation Id - /// AccessPolicyAssignment_Get + /// RedisCacheAccessPolicyAssignment_Get /// /// /// Default Api Version @@ -223,11 +223,11 @@ public virtual Response Get(string acc { Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); - using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.Get"); + using var scope = _redisCacheAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.Get"); scope.Start(); try { - var response = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, cancellationToken); + var response = _redisCacheAccessPolicyAssignmentRestClient.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()); @@ -248,7 +248,7 @@ public virtual Response Get(string acc /// /// /// Operation Id - /// AccessPolicyAssignment_List + /// RedisCacheAccessPolicyAssignment_List /// /// /// Default Api Version @@ -264,9 +264,9 @@ public virtual Response Get(string acc /// 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); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisCacheAccessPolicyAssignmentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisCacheAccessPolicyAssignmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisCacheAccessPolicyAssignmentResource(Client, RedisCacheAccessPolicyAssignmentData.DeserializeRedisCacheAccessPolicyAssignmentData(e)), _redisCacheAccessPolicyAssignmentClientDiagnostics, Pipeline, "RedisCacheAccessPolicyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -278,7 +278,7 @@ public virtual AsyncPageable GetAllAsy /// /// /// Operation Id - /// AccessPolicyAssignment_List + /// RedisCacheAccessPolicyAssignment_List /// /// /// Default Api Version @@ -294,9 +294,9 @@ public virtual AsyncPageable GetAllAsy /// 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); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisCacheAccessPolicyAssignmentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisCacheAccessPolicyAssignmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisCacheAccessPolicyAssignmentResource(Client, RedisCacheAccessPolicyAssignmentData.DeserializeRedisCacheAccessPolicyAssignmentData(e)), _redisCacheAccessPolicyAssignmentClientDiagnostics, Pipeline, "RedisCacheAccessPolicyAssignmentCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -308,7 +308,7 @@ public virtual Pageable GetAll(Cancell /// /// /// Operation Id - /// AccessPolicyAssignment_Get + /// RedisCacheAccessPolicyAssignment_Get /// /// /// Default Api Version @@ -328,11 +328,11 @@ public virtual async Task> ExistsAsync(string accessPolicyAssignm { Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); - using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.Exists"); + using var scope = _redisCacheAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.Exists"); scope.Start(); try { - var response = await _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _redisCacheAccessPolicyAssignmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -351,7 +351,7 @@ public virtual async Task> ExistsAsync(string accessPolicyAssignm /// /// /// Operation Id - /// AccessPolicyAssignment_Get + /// RedisCacheAccessPolicyAssignment_Get /// /// /// Default Api Version @@ -371,11 +371,11 @@ public virtual Response Exists(string accessPolicyAssignmentName, Cancella { Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); - using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.Exists"); + using var scope = _redisCacheAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.Exists"); scope.Start(); try { - var response = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, cancellationToken: cancellationToken); + var response = _redisCacheAccessPolicyAssignmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -394,7 +394,7 @@ public virtual Response Exists(string accessPolicyAssignmentName, Cancella /// /// /// Operation Id - /// AccessPolicyAssignment_Get + /// RedisCacheAccessPolicyAssignment_Get /// /// /// Default Api Version @@ -414,11 +414,11 @@ public virtual async Task(response.GetRawResponse()); return Response.FromValue(new RedisCacheAccessPolicyAssignmentResource(Client, response.Value), response.GetRawResponse()); @@ -439,7 +439,7 @@ public virtual async Task /// /// Operation Id - /// AccessPolicyAssignment_Get + /// RedisCacheAccessPolicyAssignment_Get /// /// /// Default Api Version @@ -459,11 +459,11 @@ public virtual NullableResponse GetIfE { Argument.AssertNotNullOrEmpty(accessPolicyAssignmentName, nameof(accessPolicyAssignmentName)); - using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.GetIfExists"); + using var scope = _redisCacheAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentCollection.GetIfExists"); scope.Start(); try { - var response = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyAssignmentName, cancellationToken: cancellationToken); + var response = _redisCacheAccessPolicyAssignmentRestClient.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()); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.Serialization.cs index 6873c29c8641..db836870b99b 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.Serialization.cs @@ -48,7 +48,7 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri if (Optional.IsDefined(ObjectId)) { writer.WritePropertyName("objectId"u8); - writer.WriteStringValue(ObjectId.Value); + writer.WriteStringValue(ObjectId); } if (Optional.IsDefined(ObjectIdAlias)) { @@ -88,7 +88,7 @@ internal static RedisCacheAccessPolicyAssignmentData DeserializeRedisCacheAccess ResourceType type = default; SystemData systemData = default; AccessPolicyAssignmentProvisioningState? provisioningState = default; - Guid? objectId = default; + string objectId = default; string objectIdAlias = default; string accessPolicyName = default; IDictionary serializedAdditionalRawData = default; @@ -139,11 +139,7 @@ internal static RedisCacheAccessPolicyAssignmentData DeserializeRedisCacheAccess } if (property0.NameEquals("objectId"u8)) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - objectId = property0.Value.GetGuid(); + objectId = property0.Value.GetString(); continue; } if (property0.NameEquals("objectIdAlias"u8)) @@ -177,153 +173,6 @@ internal static RedisCacheAccessPolicyAssignmentData DeserializeRedisCacheAccess serializedAdditionalRawData); } - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Name)) - { - builder.Append(" name: "); - if (Name.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Name}'''"); - } - else - { - builder.AppendLine($"'{Name}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Id)) - { - builder.Append(" id: "); - builder.AppendLine($"'{Id.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" systemData: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SystemData)) - { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); - } - } - - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" provisioningState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ProvisioningState)) - { - builder.Append(" provisioningState: "); - builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ObjectId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" objectId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ObjectId)) - { - builder.Append(" objectId: "); - builder.AppendLine($"'{ObjectId.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ObjectIdAlias), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" objectIdAlias: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ObjectIdAlias)) - { - builder.Append(" objectIdAlias: "); - if (ObjectIdAlias.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ObjectIdAlias}'''"); - } - else - { - builder.AppendLine($"'{ObjectIdAlias}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AccessPolicyName), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" accessPolicyName: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AccessPolicyName)) - { - builder.Append(" accessPolicyName: "); - if (AccessPolicyName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{AccessPolicyName}'''"); - } - else - { - builder.AppendLine($"'{AccessPolicyName}'"); - } - } - } - - builder.AppendLine(" }"); - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -332,8 +181,6 @@ BinaryData IPersistableModel.Write(ModelRe { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisCacheAccessPolicyAssignmentData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs index 23d79d236c2b..45390b04f1f0 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs @@ -66,7 +66,7 @@ public RedisCacheAccessPolicyAssignmentData() /// User friendly name for object id. Also represents username for token based authentication. /// The name of the access policy that is being assigned. /// Keeps track of any properties unknown to the library. - internal RedisCacheAccessPolicyAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AccessPolicyAssignmentProvisioningState? provisioningState, Guid? objectId, string objectIdAlias, string accessPolicyName, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal RedisCacheAccessPolicyAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AccessPolicyAssignmentProvisioningState? provisioningState, string objectId, string objectIdAlias, string accessPolicyName, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; ObjectId = objectId; @@ -76,16 +76,12 @@ internal RedisCacheAccessPolicyAssignmentData(ResourceIdentifier id, string name } /// Provisioning state of an access policy assignment set. - [WirePath("properties.provisioningState")] public AccessPolicyAssignmentProvisioningState? ProvisioningState { get; } /// Object Id to assign access policy to. - [WirePath("properties.objectId")] - public Guid? ObjectId { get; set; } + public string ObjectId { get; set; } /// User friendly name for object id. Also represents username for token based authentication. - [WirePath("properties.objectIdAlias")] public string ObjectIdAlias { get; set; } /// The name of the access policy that is being assigned. - [WirePath("properties.accessPolicyName")] 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 index 65814a450349..871b8780b328 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentResource.cs @@ -33,8 +33,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics; - private readonly AccessPolicyAssignmentRestOperations _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient; + private readonly ClientDiagnostics _redisCacheAccessPolicyAssignmentClientDiagnostics; + private readonly RedisCacheAccessPolicyAssignmentsRestOperations _redisCacheAccessPolicyAssignmentRestClient; private readonly RedisCacheAccessPolicyAssignmentData _data; /// Gets the resource type for the operations. @@ -59,9 +59,9 @@ internal RedisCacheAccessPolicyAssignmentResource(ArmClient client, RedisCacheAc /// 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); + _redisCacheAccessPolicyAssignmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string redisCacheAccessPolicyAssignmentApiVersion); + _redisCacheAccessPolicyAssignmentRestClient = new RedisCacheAccessPolicyAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisCacheAccessPolicyAssignmentApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -97,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// AccessPolicyAssignment_Get + /// RedisCacheAccessPolicyAssignment_Get /// /// /// Default Api Version @@ -112,11 +112,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentResource.Get"); + using var scope = _redisCacheAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentResource.Get"); scope.Start(); try { - var response = await _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _redisCacheAccessPolicyAssignmentRestClient.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()); @@ -137,7 +137,7 @@ public virtual async Task> Ge /// /// /// Operation Id - /// AccessPolicyAssignment_Get + /// RedisCacheAccessPolicyAssignment_Get /// /// /// Default Api Version @@ -152,11 +152,11 @@ public virtual async Task> Ge /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentResource.Get"); + using var scope = _redisCacheAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentResource.Get"); scope.Start(); try { - var response = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _redisCacheAccessPolicyAssignmentRestClient.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()); @@ -177,7 +177,7 @@ public virtual Response Get(Cancellati /// /// /// Operation Id - /// AccessPolicyAssignment_Delete + /// RedisCacheAccessPolicyAssignment_Delete /// /// /// Default Api Version @@ -193,12 +193,12 @@ public virtual Response Get(Cancellati /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentResource.Delete"); + using var scope = _redisCacheAccessPolicyAssignmentClientDiagnostics.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); + var response = await _redisCacheAccessPolicyAssignmentRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(_redisCacheAccessPolicyAssignmentClientDiagnostics, Pipeline, _redisCacheAccessPolicyAssignmentRestClient.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; @@ -219,7 +219,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// AccessPolicyAssignment_Delete + /// RedisCacheAccessPolicyAssignment_Delete /// /// /// Default Api Version @@ -235,12 +235,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentResource.Delete"); + using var scope = _redisCacheAccessPolicyAssignmentClientDiagnostics.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); + var response = _redisCacheAccessPolicyAssignmentRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new RedisArmOperation(_redisCacheAccessPolicyAssignmentClientDiagnostics, Pipeline, _redisCacheAccessPolicyAssignmentRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -261,7 +261,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// AccessPolicyAssignment_CreateUpdate + /// RedisCacheAccessPolicyAssignment_CreateUpdate /// /// /// Default Api Version @@ -281,12 +281,12 @@ public virtual async Task { Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentResource.Update"); + using var scope = _redisCacheAccessPolicyAssignmentClientDiagnostics.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); + var response = await _redisCacheAccessPolicyAssignmentRestClient.CreateUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyAssignmentOperationSource(Client), _redisCacheAccessPolicyAssignmentClientDiagnostics, Pipeline, _redisCacheAccessPolicyAssignmentRestClient.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; @@ -307,7 +307,7 @@ public virtual async Task /// /// /// Operation Id - /// AccessPolicyAssignment_CreateUpdate + /// RedisCacheAccessPolicyAssignment_CreateUpdate /// /// /// Default Api Version @@ -327,12 +327,12 @@ public virtual ArmOperation Update(Wai { Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisCacheAccessPolicyAssignmentAccessPolicyAssignmentClientDiagnostics.CreateScope("RedisCacheAccessPolicyAssignmentResource.Update"); + using var scope = _redisCacheAccessPolicyAssignmentClientDiagnostics.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); + var response = _redisCacheAccessPolicyAssignmentRestClient.CreateUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyAssignmentOperationSource(Client), _redisCacheAccessPolicyAssignmentClientDiagnostics, Pipeline, _redisCacheAccessPolicyAssignmentRestClient.CreateCreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyCollection.cs index e5aefb8c5c0b..450eb6f5e05e 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyCollection.cs @@ -24,8 +24,8 @@ namespace Azure.ResourceManager.Redis /// public partial class RedisCacheAccessPolicyCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _redisCacheAccessPolicyAccessPolicyClientDiagnostics; - private readonly AccessPolicyRestOperations _redisCacheAccessPolicyAccessPolicyRestClient; + private readonly ClientDiagnostics _redisCacheAccessPolicyClientDiagnostics; + private readonly RedisCacheAccessPoliciesRestOperations _redisCacheAccessPolicyRestClient; /// Initializes a new instance of the class for mocking. protected RedisCacheAccessPolicyCollection() @@ -37,9 +37,9 @@ protected RedisCacheAccessPolicyCollection() /// 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); + _redisCacheAccessPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", RedisCacheAccessPolicyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(RedisCacheAccessPolicyResource.ResourceType, out string redisCacheAccessPolicyApiVersion); + _redisCacheAccessPolicyRestClient = new RedisCacheAccessPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisCacheAccessPolicyApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -60,7 +60,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// AccessPolicy_CreateUpdate + /// RedisCacheAccessPolicy_CreateUpdate /// /// /// Default Api Version @@ -83,12 +83,12 @@ public virtual async Task> CreateOr Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.CreateOrUpdate"); + using var scope = _redisCacheAccessPolicyClientDiagnostics.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); + var response = await _redisCacheAccessPolicyRestClient.CreateUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, data, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyOperationSource(Client), _redisCacheAccessPolicyClientDiagnostics, Pipeline, _redisCacheAccessPolicyRestClient.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; @@ -109,7 +109,7 @@ public virtual async Task> CreateOr /// /// /// Operation Id - /// AccessPolicy_CreateUpdate + /// RedisCacheAccessPolicy_CreateUpdate /// /// /// Default Api Version @@ -132,12 +132,12 @@ public virtual ArmOperation CreateOrUpdate(WaitU Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.CreateOrUpdate"); + using var scope = _redisCacheAccessPolicyClientDiagnostics.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); + var response = _redisCacheAccessPolicyRestClient.CreateUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, data, cancellationToken); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyOperationSource(Client), _redisCacheAccessPolicyClientDiagnostics, Pipeline, _redisCacheAccessPolicyRestClient.CreateCreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -158,7 +158,7 @@ public virtual ArmOperation CreateOrUpdate(WaitU /// /// /// Operation Id - /// AccessPolicy_Get + /// RedisCacheAccessPolicy_Get /// /// /// Default Api Version @@ -178,11 +178,11 @@ public virtual async Task> GetAsync(str { Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); - using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.Get"); + using var scope = _redisCacheAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.Get"); scope.Start(); try { - var response = await _redisCacheAccessPolicyAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, cancellationToken).ConfigureAwait(false); + var response = await _redisCacheAccessPolicyRestClient.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()); @@ -203,7 +203,7 @@ public virtual async Task> GetAsync(str /// /// /// Operation Id - /// AccessPolicy_Get + /// RedisCacheAccessPolicy_Get /// /// /// Default Api Version @@ -223,11 +223,11 @@ public virtual Response Get(string accessPolicyN { Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); - using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.Get"); + using var scope = _redisCacheAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.Get"); scope.Start(); try { - var response = _redisCacheAccessPolicyAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, cancellationToken); + var response = _redisCacheAccessPolicyRestClient.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()); @@ -248,7 +248,7 @@ public virtual Response Get(string accessPolicyN /// /// /// Operation Id - /// AccessPolicy_List + /// RedisCacheAccessPolicy_List /// /// /// Default Api Version @@ -264,9 +264,9 @@ public virtual Response Get(string accessPolicyN /// 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); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisCacheAccessPolicyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisCacheAccessPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisCacheAccessPolicyResource(Client, RedisCacheAccessPolicyData.DeserializeRedisCacheAccessPolicyData(e)), _redisCacheAccessPolicyClientDiagnostics, Pipeline, "RedisCacheAccessPolicyCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -278,7 +278,7 @@ public virtual AsyncPageable GetAllAsync(Cancell /// /// /// Operation Id - /// AccessPolicy_List + /// RedisCacheAccessPolicy_List /// /// /// Default Api Version @@ -294,9 +294,9 @@ public virtual AsyncPageable GetAllAsync(Cancell /// 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); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisCacheAccessPolicyRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisCacheAccessPolicyRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisCacheAccessPolicyResource(Client, RedisCacheAccessPolicyData.DeserializeRedisCacheAccessPolicyData(e)), _redisCacheAccessPolicyClientDiagnostics, Pipeline, "RedisCacheAccessPolicyCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -308,7 +308,7 @@ public virtual Pageable GetAll(CancellationToken /// /// /// Operation Id - /// AccessPolicy_Get + /// RedisCacheAccessPolicy_Get /// /// /// Default Api Version @@ -328,11 +328,11 @@ public virtual async Task> ExistsAsync(string accessPolicyName, C { Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); - using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.Exists"); + using var scope = _redisCacheAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.Exists"); scope.Start(); try { - var response = await _redisCacheAccessPolicyAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _redisCacheAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -351,7 +351,7 @@ public virtual async Task> ExistsAsync(string accessPolicyName, C /// /// /// Operation Id - /// AccessPolicy_Get + /// RedisCacheAccessPolicy_Get /// /// /// Default Api Version @@ -371,11 +371,11 @@ public virtual Response Exists(string accessPolicyName, CancellationToken { Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); - using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.Exists"); + using var scope = _redisCacheAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.Exists"); scope.Start(); try { - var response = _redisCacheAccessPolicyAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, cancellationToken: cancellationToken); + var response = _redisCacheAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -394,7 +394,7 @@ public virtual Response Exists(string accessPolicyName, CancellationToken /// /// /// Operation Id - /// AccessPolicy_Get + /// RedisCacheAccessPolicy_Get /// /// /// Default Api Version @@ -414,11 +414,11 @@ public virtual async Task> GetI { Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); - using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.GetIfExists"); + using var scope = _redisCacheAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.GetIfExists"); scope.Start(); try { - var response = await _redisCacheAccessPolicyAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _redisCacheAccessPolicyRestClient.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()); @@ -439,7 +439,7 @@ public virtual async Task> GetI /// /// /// Operation Id - /// AccessPolicy_Get + /// RedisCacheAccessPolicy_Get /// /// /// Default Api Version @@ -459,11 +459,11 @@ public virtual NullableResponse GetIfExists(stri { Argument.AssertNotNullOrEmpty(accessPolicyName, nameof(accessPolicyName)); - using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.GetIfExists"); + using var scope = _redisCacheAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyCollection.GetIfExists"); scope.Start(); try { - var response = _redisCacheAccessPolicyAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, accessPolicyName, cancellationToken: cancellationToken); + var response = _redisCacheAccessPolicyRestClient.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()); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.Serialization.cs index 1263192d3a48..fc7014dc6457 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.Serialization.cs @@ -45,10 +45,10 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("provisioningState"u8); writer.WriteStringValue(ProvisioningState.Value.ToString()); } - if (options.Format != "W" && Optional.IsDefined(TypePropertiesType)) + if (options.Format != "W" && Optional.IsDefined(Type)) { writer.WritePropertyName("type"u8); - writer.WriteStringValue(TypePropertiesType.Value.ToString()); + writer.WriteStringValue(Type.Value.ToString()); } if (Optional.IsDefined(Permissions)) { @@ -165,130 +165,6 @@ internal static RedisCacheAccessPolicyData DeserializeRedisCacheAccessPolicyData serializedAdditionalRawData); } - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Name)) - { - builder.Append(" name: "); - if (Name.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Name}'''"); - } - else - { - builder.AppendLine($"'{Name}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Id)) - { - builder.Append(" id: "); - builder.AppendLine($"'{Id.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" systemData: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SystemData)) - { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); - } - } - - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" provisioningState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ProvisioningState)) - { - builder.Append(" provisioningState: "); - builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TypePropertiesType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" type: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(TypePropertiesType)) - { - builder.Append(" type: "); - builder.AppendLine($"'{TypePropertiesType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Permissions), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" permissions: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Permissions)) - { - builder.Append(" permissions: "); - if (Permissions.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Permissions}'''"); - } - else - { - builder.AppendLine($"'{Permissions}'"); - } - } - } - - builder.AppendLine(" }"); - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -297,8 +173,6 @@ BinaryData IPersistableModel.Write(ModelReaderWriter { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisCacheAccessPolicyData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.cs index abe048f77d0e..948558088df9 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.cs @@ -62,25 +62,22 @@ public RedisCacheAccessPolicyData() /// The resourceType. /// The systemData. /// Provisioning state of access policy. - /// Built-In or Custom access policy. + /// Built-In or Custom access policy. /// Permissions for the access policy. Learn how to configure permissions at https://aka.ms/redis/AADPreRequisites. /// Keeps track of any properties unknown to the library. - internal RedisCacheAccessPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AccessPolicyProvisioningState? provisioningState, AccessPolicyType? typePropertiesType, string permissions, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal RedisCacheAccessPolicyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AccessPolicyProvisioningState? provisioningState, AccessPolicyType? type, string permissions, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; - TypePropertiesType = typePropertiesType; + Type = type; Permissions = permissions; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Provisioning state of access policy. - [WirePath("properties.provisioningState")] public AccessPolicyProvisioningState? ProvisioningState { get; } /// Built-In or Custom access policy. - [WirePath("properties.type")] - public AccessPolicyType? TypePropertiesType { get; } + public AccessPolicyType? Type { get; } /// Permissions for the access policy. Learn how to configure permissions at https://aka.ms/redis/AADPreRequisites. - [WirePath("properties.permissions")] 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 index a06f2cbd8a82..85c0fe3d0adc 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyResource.cs @@ -33,8 +33,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _redisCacheAccessPolicyAccessPolicyClientDiagnostics; - private readonly AccessPolicyRestOperations _redisCacheAccessPolicyAccessPolicyRestClient; + private readonly ClientDiagnostics _redisCacheAccessPolicyClientDiagnostics; + private readonly RedisCacheAccessPoliciesRestOperations _redisCacheAccessPolicyRestClient; private readonly RedisCacheAccessPolicyData _data; /// Gets the resource type for the operations. @@ -59,9 +59,9 @@ internal RedisCacheAccessPolicyResource(ArmClient client, RedisCacheAccessPolicy /// 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); + _redisCacheAccessPolicyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string redisCacheAccessPolicyApiVersion); + _redisCacheAccessPolicyRestClient = new RedisCacheAccessPoliciesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisCacheAccessPolicyApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -97,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// AccessPolicy_Get + /// RedisCacheAccessPolicy_Get /// /// /// Default Api Version @@ -112,11 +112,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyResource.Get"); + using var scope = _redisCacheAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyResource.Get"); scope.Start(); try { - var response = await _redisCacheAccessPolicyAccessPolicyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _redisCacheAccessPolicyRestClient.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()); @@ -137,7 +137,7 @@ public virtual async Task> GetAsync(Can /// /// /// Operation Id - /// AccessPolicy_Get + /// RedisCacheAccessPolicy_Get /// /// /// Default Api Version @@ -152,11 +152,11 @@ public virtual async Task> GetAsync(Can /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyResource.Get"); + using var scope = _redisCacheAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyResource.Get"); scope.Start(); try { - var response = _redisCacheAccessPolicyAccessPolicyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _redisCacheAccessPolicyRestClient.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()); @@ -177,7 +177,7 @@ public virtual Response Get(CancellationToken ca /// /// /// Operation Id - /// AccessPolicy_Delete + /// RedisCacheAccessPolicy_Delete /// /// /// Default Api Version @@ -193,12 +193,12 @@ public virtual Response Get(CancellationToken ca /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyResource.Delete"); + using var scope = _redisCacheAccessPolicyClientDiagnostics.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); + var response = await _redisCacheAccessPolicyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(_redisCacheAccessPolicyClientDiagnostics, Pipeline, _redisCacheAccessPolicyRestClient.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; @@ -219,7 +219,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// AccessPolicy_Delete + /// RedisCacheAccessPolicy_Delete /// /// /// Default Api Version @@ -235,12 +235,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyResource.Delete"); + using var scope = _redisCacheAccessPolicyClientDiagnostics.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); + var response = _redisCacheAccessPolicyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new RedisArmOperation(_redisCacheAccessPolicyClientDiagnostics, Pipeline, _redisCacheAccessPolicyRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -261,7 +261,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// AccessPolicy_CreateUpdate + /// RedisCacheAccessPolicy_CreateUpdate /// /// /// Default Api Version @@ -281,12 +281,12 @@ public virtual async Task> UpdateAs { Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyResource.Update"); + using var scope = _redisCacheAccessPolicyClientDiagnostics.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); + var response = await _redisCacheAccessPolicyRestClient.CreateUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyOperationSource(Client), _redisCacheAccessPolicyClientDiagnostics, Pipeline, _redisCacheAccessPolicyRestClient.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; @@ -307,7 +307,7 @@ public virtual async Task> UpdateAs /// /// /// Operation Id - /// AccessPolicy_CreateUpdate + /// RedisCacheAccessPolicy_CreateUpdate /// /// /// Default Api Version @@ -327,12 +327,12 @@ public virtual ArmOperation Update(WaitUntil wai { Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisCacheAccessPolicyAccessPolicyClientDiagnostics.CreateScope("RedisCacheAccessPolicyResource.Update"); + using var scope = _redisCacheAccessPolicyClientDiagnostics.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); + var response = _redisCacheAccessPolicyRestClient.CreateUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new RedisArmOperation(new RedisCacheAccessPolicyOperationSource(Client), _redisCacheAccessPolicyClientDiagnostics, Pipeline, _redisCacheAccessPolicyRestClient.CreateCreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.Serialization.cs deleted file mode 100644 index 305ddb7222c2..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.Serialization.cs +++ /dev/null @@ -1,1207 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Text; -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.Redis.Models; -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.Redis -{ - public partial class RedisData : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsCollectionDefined(Zones)) - { - writer.WritePropertyName("zones"u8); - writer.WriteStartArray(); - foreach (var item in Zones) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(Identity)) - { - writer.WritePropertyName("identity"u8); - ((IJsonModel)Identity).Write(writer, options); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(RedisConfiguration)) - { - writer.WritePropertyName("redisConfiguration"u8); - writer.WriteObjectValue(RedisConfiguration, options); - } - if (Optional.IsDefined(RedisVersion)) - { - writer.WritePropertyName("redisVersion"u8); - writer.WriteStringValue(RedisVersion); - } - if (Optional.IsDefined(EnableNonSslPort)) - { - writer.WritePropertyName("enableNonSslPort"u8); - writer.WriteBooleanValue(EnableNonSslPort.Value); - } - if (Optional.IsDefined(ReplicasPerMaster)) - { - writer.WritePropertyName("replicasPerMaster"u8); - writer.WriteNumberValue(ReplicasPerMaster.Value); - } - if (Optional.IsDefined(ReplicasPerPrimary)) - { - writer.WritePropertyName("replicasPerPrimary"u8); - writer.WriteNumberValue(ReplicasPerPrimary.Value); - } - if (Optional.IsCollectionDefined(TenantSettings)) - { - writer.WritePropertyName("tenantSettings"u8); - writer.WriteStartObject(); - foreach (var item in TenantSettings) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(ShardCount)) - { - writer.WritePropertyName("shardCount"u8); - writer.WriteNumberValue(ShardCount.Value); - } - if (Optional.IsDefined(MinimumTlsVersion)) - { - writer.WritePropertyName("minimumTlsVersion"u8); - writer.WriteStringValue(MinimumTlsVersion.Value.ToString()); - } - if (Optional.IsDefined(PublicNetworkAccess)) - { - 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(IsAccessKeyAuthenticationDisabled)) - { - writer.WritePropertyName("disableAccessKeyAuthentication"u8); - writer.WriteBooleanValue(IsAccessKeyAuthenticationDisabled.Value); - } - if (Optional.IsDefined(ZonalAllocationPolicy)) - { - writer.WritePropertyName("zonalAllocationPolicy"u8); - writer.WriteStringValue(ZonalAllocationPolicy.Value.ToString()); - } - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku, options); - if (Optional.IsDefined(SubnetId)) - { - writer.WritePropertyName("subnetId"u8); - writer.WriteStringValue(SubnetId); - } - if (Optional.IsDefined(StaticIP)) - { - writer.WritePropertyName("staticIP"u8); - writer.WriteStringValue(StaticIP.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(HostName)) - { - writer.WritePropertyName("hostName"u8); - writer.WriteStringValue(HostName); - } - if (options.Format != "W" && Optional.IsDefined(Port)) - { - writer.WritePropertyName("port"u8); - writer.WriteNumberValue(Port.Value); - } - if (options.Format != "W" && Optional.IsDefined(SslPort)) - { - writer.WritePropertyName("sslPort"u8); - writer.WriteNumberValue(SslPort.Value); - } - if (options.Format != "W" && Optional.IsDefined(AccessKeys)) - { - if (AccessKeys != null) - { - writer.WritePropertyName("accessKeys"u8); - writer.WriteObjectValue(AccessKeys, options); - } - else - { - writer.WriteNull("accessKeys"); - } - } - if (options.Format != "W" && Optional.IsCollectionDefined(LinkedServers)) - { - writer.WritePropertyName("linkedServers"u8); - writer.WriteStartArray(); - foreach (var item in LinkedServers) - { - ((IJsonModel)item).Write(writer, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsCollectionDefined(Instances)) - { - writer.WritePropertyName("instances"u8); - writer.WriteStartArray(); - foreach (var item in Instances) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsCollectionDefined(PrivateEndpointConnections)) - { - writer.WritePropertyName("privateEndpointConnections"u8); - writer.WriteStartArray(); - foreach (var item in PrivateEndpointConnections) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - } - - RedisData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(RedisData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisData(document.RootElement, options); - } - - internal static RedisData DeserializeRedisData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList zones = default; - ManagedServiceIdentity identity = default; - IDictionary tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - RedisCommonConfiguration redisConfiguration = default; - string redisVersion = default; - bool? enableNonSslPort = default; - int? replicasPerMaster = default; - int? replicasPerPrimary = default; - IDictionary tenantSettings = default; - int? shardCount = default; - RedisTlsVersion? minimumTlsVersion = default; - RedisPublicNetworkAccess? publicNetworkAccess = default; - UpdateChannel? updateChannel = default; - bool? disableAccessKeyAuthentication = default; - ZonalAllocationPolicy? zonalAllocationPolicy = default; - RedisSku sku = default; - ResourceIdentifier subnetId = default; - IPAddress staticIP = default; - RedisProvisioningState? provisioningState = default; - string hostName = default; - int? port = default; - int? sslPort = default; - RedisAccessKeys accessKeys = default; - IReadOnlyList linkedServers = default; - IReadOnlyList instances = default; - IReadOnlyList privateEndpointConnections = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("zones"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - zones = array; - continue; - } - if (property.NameEquals("identity"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), options, AzureResourceManagerRedisContext.Default); - continue; - } - if (property.NameEquals("tags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property.NameEquals("location"u8)) - { - location = new AzureLocation(property.Value.GetString()); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerRedisContext.Default); - 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("redisConfiguration"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - redisConfiguration = RedisCommonConfiguration.DeserializeRedisCommonConfiguration(property0.Value, options); - continue; - } - if (property0.NameEquals("redisVersion"u8)) - { - redisVersion = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("enableNonSslPort"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableNonSslPort = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("replicasPerMaster"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - replicasPerMaster = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("replicasPerPrimary"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - replicasPerPrimary = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("tenantSettings"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property1 in property0.Value.EnumerateObject()) - { - dictionary.Add(property1.Name, property1.Value.GetString()); - } - tenantSettings = dictionary; - continue; - } - if (property0.NameEquals("shardCount"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - shardCount = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("minimumTlsVersion"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - minimumTlsVersion = new RedisTlsVersion(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("publicNetworkAccess"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - 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("disableAccessKeyAuthentication"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - disableAccessKeyAuthentication = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("zonalAllocationPolicy"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - zonalAllocationPolicy = new ZonalAllocationPolicy(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("sku"u8)) - { - sku = RedisSku.DeserializeRedisSku(property0.Value, options); - continue; - } - if (property0.NameEquals("subnetId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - subnetId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("staticIP"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - staticIP = IPAddress.Parse(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningState = new RedisProvisioningState(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("hostName"u8)) - { - hostName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("port"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - port = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("sslPort"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sslPort = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("accessKeys"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - accessKeys = null; - continue; - } - accessKeys = RedisAccessKeys.DeserializeRedisAccessKeys(property0.Value, options); - continue; - } - if (property0.NameEquals("linkedServers"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(item.GetRawText())), options, AzureResourceManagerRedisContext.Default)); - } - linkedServers = array; - continue; - } - if (property0.NameEquals("instances"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(RedisInstanceDetails.DeserializeRedisInstanceDetails(item, options)); - } - instances = array; - continue; - } - if (property0.NameEquals("privateEndpointConnections"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(RedisPrivateEndpointConnectionData.DeserializeRedisPrivateEndpointConnectionData(item, options)); - } - privateEndpointConnections = array; - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new RedisData( - id, - name, - type, - systemData, - tags ?? new ChangeTrackingDictionary(), - location, - zones ?? new ChangeTrackingList(), - identity, - redisConfiguration, - redisVersion, - enableNonSslPort, - replicasPerMaster, - replicasPerPrimary, - tenantSettings ?? new ChangeTrackingDictionary(), - shardCount, - minimumTlsVersion, - publicNetworkAccess, - updateChannel, - disableAccessKeyAuthentication, - zonalAllocationPolicy, - sku, - subnetId, - staticIP, - provisioningState, - hostName, - port, - sslPort, - accessKeys, - linkedServers ?? new ChangeTrackingList(), - instances ?? new ChangeTrackingList(), - privateEndpointConnections ?? new ChangeTrackingList(), - serializedAdditionalRawData); - } - - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Name)) - { - builder.Append(" name: "); - if (Name.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Name}'''"); - } - else - { - builder.AppendLine($"'{Name}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" location: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" location: "); - builder.AppendLine($"'{Location.ToString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tags: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Tags)) - { - if (Tags.Any()) - { - builder.Append(" tags: "); - builder.AppendLine("{"); - foreach (var item in Tags) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - if (item.Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{item.Value}'''"); - } - else - { - builder.AppendLine($"'{item.Value}'"); - } - } - builder.AppendLine(" }"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Zones), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" zones: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Zones)) - { - if (Zones.Any()) - { - builder.Append(" zones: "); - builder.AppendLine("["); - foreach (var item in Zones) - { - if (item == null) - { - builder.Append("null"); - continue; - } - if (item.Contains(Environment.NewLine)) - { - builder.AppendLine(" '''"); - builder.AppendLine($"{item}'''"); - } - else - { - builder.AppendLine($" '{item}'"); - } - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" identity: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Identity)) - { - builder.Append(" identity: "); - BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Id)) - { - builder.Append(" id: "); - builder.AppendLine($"'{Id.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" systemData: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SystemData)) - { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); - } - } - - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RedisConfiguration), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" redisConfiguration: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RedisConfiguration)) - { - builder.Append(" redisConfiguration: "); - BicepSerializationHelpers.AppendChildObject(builder, RedisConfiguration, options, 4, false, " redisConfiguration: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RedisVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" redisVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RedisVersion)) - { - builder.Append(" redisVersion: "); - if (RedisVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{RedisVersion}'''"); - } - else - { - builder.AppendLine($"'{RedisVersion}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableNonSslPort), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableNonSslPort: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableNonSslPort)) - { - builder.Append(" enableNonSslPort: "); - var boolValue = EnableNonSslPort.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ReplicasPerMaster), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" replicasPerMaster: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ReplicasPerMaster)) - { - builder.Append(" replicasPerMaster: "); - builder.AppendLine($"{ReplicasPerMaster.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ReplicasPerPrimary), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" replicasPerPrimary: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ReplicasPerPrimary)) - { - builder.Append(" replicasPerPrimary: "); - builder.AppendLine($"{ReplicasPerPrimary.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TenantSettings), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tenantSettings: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(TenantSettings)) - { - if (TenantSettings.Any()) - { - builder.Append(" tenantSettings: "); - builder.AppendLine("{"); - foreach (var item in TenantSettings) - { - builder.Append($" '{item.Key}': "); - if (item.Value == null) - { - builder.Append("null"); - continue; - } - if (item.Value.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{item.Value}'''"); - } - else - { - builder.AppendLine($"'{item.Value}'"); - } - } - builder.AppendLine(" }"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ShardCount), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" shardCount: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ShardCount)) - { - builder.Append(" shardCount: "); - builder.AppendLine($"{ShardCount.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MinimumTlsVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" minimumTlsVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MinimumTlsVersion)) - { - builder.Append(" minimumTlsVersion: "); - builder.AppendLine($"'{MinimumTlsVersion.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PublicNetworkAccess), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" publicNetworkAccess: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PublicNetworkAccess)) - { - builder.Append(" publicNetworkAccess: "); - builder.AppendLine($"'{PublicNetworkAccess.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UpdateChannel), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" updateChannel: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(UpdateChannel)) - { - builder.Append(" updateChannel: "); - builder.AppendLine($"'{UpdateChannel.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsAccessKeyAuthenticationDisabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" disableAccessKeyAuthentication: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsAccessKeyAuthenticationDisabled)) - { - builder.Append(" disableAccessKeyAuthentication: "); - var boolValue = IsAccessKeyAuthenticationDisabled.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ZonalAllocationPolicy), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" zonalAllocationPolicy: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ZonalAllocationPolicy)) - { - builder.Append(" zonalAllocationPolicy: "); - builder.AppendLine($"'{ZonalAllocationPolicy.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Sku), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" sku: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Sku)) - { - builder.Append(" sku: "); - BicepSerializationHelpers.AppendChildObject(builder, Sku, options, 4, false, " sku: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SubnetId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" subnetId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SubnetId)) - { - builder.Append(" subnetId: "); - builder.AppendLine($"'{SubnetId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StaticIP), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" staticIP: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(StaticIP)) - { - builder.Append(" staticIP: "); - builder.AppendLine($"'{StaticIP.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" provisioningState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ProvisioningState)) - { - builder.Append(" provisioningState: "); - builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HostName), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" hostName: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(HostName)) - { - builder.Append(" hostName: "); - if (HostName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{HostName}'''"); - } - else - { - builder.AppendLine($"'{HostName}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Port), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" port: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Port)) - { - builder.Append(" port: "); - builder.AppendLine($"{Port.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SslPort), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" sslPort: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SslPort)) - { - builder.Append(" sslPort: "); - builder.AppendLine($"{SslPort.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AccessKeys), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" accessKeys: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AccessKeys)) - { - builder.Append(" accessKeys: "); - BicepSerializationHelpers.AppendChildObject(builder, AccessKeys, options, 4, false, " accessKeys: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LinkedServers), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" linkedServers: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(LinkedServers)) - { - if (LinkedServers.Any()) - { - builder.Append(" linkedServers: "); - builder.AppendLine("["); - foreach (var item in LinkedServers) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " linkedServers: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Instances), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" instances: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Instances)) - { - if (Instances.Any()) - { - builder.Append(" instances: "); - builder.AppendLine("["); - foreach (var item in Instances) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " instances: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateEndpointConnections), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateEndpointConnections: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(PrivateEndpointConnections)) - { - if (PrivateEndpointConnections.Any()) - { - builder.Append(" privateEndpointConnections: "); - builder.AppendLine("["); - foreach (var item in PrivateEndpointConnections) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " privateEndpointConnections: "); - } - builder.AppendLine(" ]"); - } - } - } - - builder.AppendLine(" }"); - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); - default: - throw new FormatException($"The model {nameof(RedisData)} does not support writing '{options.Format}' format."); - } - } - - RedisData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(RedisData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.cs deleted file mode 100644 index 74b4b3b58549..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.cs +++ /dev/null @@ -1,216 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Net; -using Azure.Core; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.Redis.Models; -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.Redis -{ - /// - /// A class representing the Redis data model. - /// A single Redis item in List or Get Operation. - /// - public partial class RedisData : TrackedResourceData - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// The location. - /// The SKU of the Redis cache to deploy. - /// is null. - public RedisData(AzureLocation location, RedisSku sku) : base(location) - { - Argument.AssertNotNull(sku, nameof(sku)); - - Zones = new ChangeTrackingList(); - TenantSettings = new ChangeTrackingDictionary(); - Sku = sku; - LinkedServers = new ChangeTrackingList(); - Instances = new ChangeTrackingList(); - PrivateEndpointConnections = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// 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, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-1 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'. - /// 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'. - /// Authentication to Redis through access keys is disabled when set as true. Default value is false. - /// Optional: Specifies how availability zones are allocated to the Redis cache. 'Automatic' enables zone redundancy and Azure will automatically select zones based on regional availability and capacity. 'UserDefined' will select availability zones passed in by you using the 'zones' parameter. 'NoZones' will produce a non-zonal cache. If 'zonalAllocationPolicy' is not passed, it will be set to 'UserDefined' when zones are passed in, otherwise, it will be set to 'Automatic' in regions where zones are supported and 'NoZones' in regions where zones are not supported. - /// 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. - /// Keeps track of any properties unknown to the library. - 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, bool? isAccessKeyAuthenticationDisabled, ZonalAllocationPolicy? zonalAllocationPolicy, RedisSku sku, ResourceIdentifier subnetId, IPAddress staticIP, RedisProvisioningState? provisioningState, string hostName, int? port, int? sslPort, RedisAccessKeys accessKeys, IReadOnlyList linkedServers, IReadOnlyList instances, IReadOnlyList privateEndpointConnections, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) - { - Zones = zones; - Identity = identity; - RedisConfiguration = redisConfiguration; - RedisVersion = redisVersion; - EnableNonSslPort = enableNonSslPort; - ReplicasPerMaster = replicasPerMaster; - ReplicasPerPrimary = replicasPerPrimary; - TenantSettings = tenantSettings; - ShardCount = shardCount; - MinimumTlsVersion = minimumTlsVersion; - PublicNetworkAccess = publicNetworkAccess; - UpdateChannel = updateChannel; - IsAccessKeyAuthenticationDisabled = isAccessKeyAuthenticationDisabled; - ZonalAllocationPolicy = zonalAllocationPolicy; - Sku = sku; - SubnetId = subnetId; - StaticIP = staticIP; - ProvisioningState = provisioningState; - HostName = hostName; - Port = port; - SslPort = sslPort; - AccessKeys = accessKeys; - LinkedServers = linkedServers; - Instances = instances; - PrivateEndpointConnections = privateEndpointConnections; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal RedisData() - { - } - - /// A list of availability zones denoting where the resource needs to come from. - [WirePath("zones")] - public IList Zones { get; } - /// The identity of the resource. - [WirePath("identity")] - public ManagedServiceIdentity Identity { get; set; } - /// All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta, maxmemory-policy,notify-keyspace-events, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-1 etc. - [WirePath("properties.redisConfiguration")] - public RedisCommonConfiguration RedisConfiguration { get; set; } - /// 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'. - [WirePath("properties.redisVersion")] - public string RedisVersion { get; set; } - /// Specifies whether the non-ssl Redis server port (6379) is enabled. - [WirePath("properties.enableNonSslPort")] - public bool? EnableNonSslPort { get; set; } - /// The number of replicas to be created per primary. - [WirePath("properties.replicasPerMaster")] - public int? ReplicasPerMaster { get; set; } - /// The number of replicas to be created per primary. - [WirePath("properties.replicasPerPrimary")] - public int? ReplicasPerPrimary { get; set; } - /// A dictionary of tenant settings. - [WirePath("properties.tenantSettings")] - public IDictionary TenantSettings { get; } - /// The number of shards to be created on a Premium Cluster Cache. - [WirePath("properties.shardCount")] - public int? ShardCount { get; set; } - /// Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). - [WirePath("properties.minimumTlsVersion")] - 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'. - [WirePath("properties.publicNetworkAccess")] - 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'. - [WirePath("properties.updateChannel")] - public UpdateChannel? UpdateChannel { get; set; } - /// Authentication to Redis through access keys is disabled when set as true. Default value is false. - [WirePath("properties.disableAccessKeyAuthentication")] - public bool? IsAccessKeyAuthenticationDisabled { get; set; } - /// Optional: Specifies how availability zones are allocated to the Redis cache. 'Automatic' enables zone redundancy and Azure will automatically select zones based on regional availability and capacity. 'UserDefined' will select availability zones passed in by you using the 'zones' parameter. 'NoZones' will produce a non-zonal cache. If 'zonalAllocationPolicy' is not passed, it will be set to 'UserDefined' when zones are passed in, otherwise, it will be set to 'Automatic' in regions where zones are supported and 'NoZones' in regions where zones are not supported. - [WirePath("properties.zonalAllocationPolicy")] - public ZonalAllocationPolicy? ZonalAllocationPolicy { get; set; } - /// The SKU of the Redis cache to deploy. - [WirePath("properties.sku")] - 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. - [WirePath("properties.subnetId")] - public ResourceIdentifier SubnetId { get; set; } - /// Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. - [WirePath("properties.staticIP")] - public IPAddress StaticIP { get; set; } - /// Redis instance provisioning status. - [WirePath("properties.provisioningState")] - public RedisProvisioningState? ProvisioningState { get; } - /// Redis host name. - [WirePath("properties.hostName")] - public string HostName { get; } - /// Redis non-SSL port. - [WirePath("properties.port")] - public int? Port { get; } - /// Redis SSL port. - [WirePath("properties.sslPort")] - public int? SslPort { get; } - /// The keys of the Redis cache - not set if this object is not the response to Create or Update redis cache. - [WirePath("properties.accessKeys")] - public RedisAccessKeys AccessKeys { get; } - /// List of the linked servers associated with the cache. - [WirePath("properties.linkedServers")] - public IReadOnlyList LinkedServers { get; } - /// List of the Redis instances associated with the cache. - [WirePath("properties.instances")] - public IReadOnlyList Instances { get; } - /// List of private endpoint connection associated with the specified redis cache. - [WirePath("properties.privateEndpointConnections")] - public IReadOnlyList PrivateEndpointConnections { get; } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleCollection.cs index ab6f683d98d6..a42887d95a60 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleCollection.cs @@ -24,8 +24,8 @@ namespace Azure.ResourceManager.Redis /// public partial class RedisFirewallRuleCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _redisFirewallRuleFirewallRulesClientDiagnostics; - private readonly FirewallRulesRestOperations _redisFirewallRuleFirewallRulesRestClient; + private readonly ClientDiagnostics _redisFirewallRuleClientDiagnostics; + private readonly RedisFirewallRulesRestOperations _redisFirewallRuleRestClient; /// Initializes a new instance of the class for mocking. protected RedisFirewallRuleCollection() @@ -37,9 +37,9 @@ protected RedisFirewallRuleCollection() /// The identifier of the parent resource that is the target of operations. internal RedisFirewallRuleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _redisFirewallRuleFirewallRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", RedisFirewallRuleResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(RedisFirewallRuleResource.ResourceType, out string redisFirewallRuleFirewallRulesApiVersion); - _redisFirewallRuleFirewallRulesRestClient = new FirewallRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisFirewallRuleFirewallRulesApiVersion); + _redisFirewallRuleClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", RedisFirewallRuleResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(RedisFirewallRuleResource.ResourceType, out string redisFirewallRuleApiVersion); + _redisFirewallRuleRestClient = new RedisFirewallRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisFirewallRuleApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -60,7 +60,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// FirewallRules_CreateOrUpdate + /// RedisFirewallRule_CreateOrUpdate /// /// /// Default Api Version @@ -83,12 +83,12 @@ public virtual async Task> CreateOrUpdat Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleCollection.CreateOrUpdate"); + using var scope = _redisFirewallRuleClientDiagnostics.CreateScope("RedisFirewallRuleCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _redisFirewallRuleFirewallRulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, data, cancellationToken).ConfigureAwait(false); - var uri = _redisFirewallRuleFirewallRulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, data); + var response = await _redisFirewallRuleRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, data, cancellationToken).ConfigureAwait(false); + var uri = _redisFirewallRuleRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new RedisArmOperation(Response.FromValue(new RedisFirewallRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -111,7 +111,7 @@ public virtual async Task> CreateOrUpdat /// /// /// Operation Id - /// FirewallRules_CreateOrUpdate + /// RedisFirewallRule_CreateOrUpdate /// /// /// Default Api Version @@ -134,12 +134,12 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleCollection.CreateOrUpdate"); + using var scope = _redisFirewallRuleClientDiagnostics.CreateScope("RedisFirewallRuleCollection.CreateOrUpdate"); scope.Start(); try { - var response = _redisFirewallRuleFirewallRulesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, data, cancellationToken); - var uri = _redisFirewallRuleFirewallRulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, data); + var response = _redisFirewallRuleRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, data, cancellationToken); + var uri = _redisFirewallRuleRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new RedisArmOperation(Response.FromValue(new RedisFirewallRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -162,7 +162,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// /// /// Operation Id - /// FirewallRules_Get + /// RedisFirewallRule_Get /// /// /// Default Api Version @@ -182,11 +182,11 @@ public virtual async Task> GetAsync(string r { Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleCollection.Get"); + using var scope = _redisFirewallRuleClientDiagnostics.CreateScope("RedisFirewallRuleCollection.Get"); scope.Start(); try { - var response = await _redisFirewallRuleFirewallRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken).ConfigureAwait(false); + var response = await _redisFirewallRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new RedisFirewallRuleResource(Client, response.Value), response.GetRawResponse()); @@ -207,7 +207,7 @@ public virtual async Task> GetAsync(string r /// /// /// Operation Id - /// FirewallRules_Get + /// RedisFirewallRule_Get /// /// /// Default Api Version @@ -227,11 +227,11 @@ public virtual Response Get(string ruleName, Cancella { Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleCollection.Get"); + using var scope = _redisFirewallRuleClientDiagnostics.CreateScope("RedisFirewallRuleCollection.Get"); scope.Start(); try { - var response = _redisFirewallRuleFirewallRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken); + var response = _redisFirewallRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new RedisFirewallRuleResource(Client, response.Value), response.GetRawResponse()); @@ -252,7 +252,7 @@ public virtual Response Get(string ruleName, Cancella /// /// /// Operation Id - /// FirewallRules_List + /// RedisFirewallRule_List /// /// /// Default Api Version @@ -268,9 +268,9 @@ public virtual Response Get(string ruleName, Cancella /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _redisFirewallRuleFirewallRulesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisFirewallRuleFirewallRulesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisFirewallRuleResource(Client, RedisFirewallRuleData.DeserializeRedisFirewallRuleData(e)), _redisFirewallRuleFirewallRulesClientDiagnostics, Pipeline, "RedisFirewallRuleCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisFirewallRuleRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisFirewallRuleRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisFirewallRuleResource(Client, RedisFirewallRuleData.DeserializeRedisFirewallRuleData(e)), _redisFirewallRuleClientDiagnostics, Pipeline, "RedisFirewallRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -282,7 +282,7 @@ public virtual AsyncPageable GetAllAsync(Cancellation /// /// /// Operation Id - /// FirewallRules_List + /// RedisFirewallRule_List /// /// /// Default Api Version @@ -298,9 +298,9 @@ public virtual AsyncPageable GetAllAsync(Cancellation /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _redisFirewallRuleFirewallRulesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisFirewallRuleFirewallRulesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisFirewallRuleResource(Client, RedisFirewallRuleData.DeserializeRedisFirewallRuleData(e)), _redisFirewallRuleFirewallRulesClientDiagnostics, Pipeline, "RedisFirewallRuleCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisFirewallRuleRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisFirewallRuleRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisFirewallRuleResource(Client, RedisFirewallRuleData.DeserializeRedisFirewallRuleData(e)), _redisFirewallRuleClientDiagnostics, Pipeline, "RedisFirewallRuleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -312,7 +312,7 @@ public virtual Pageable GetAll(CancellationToken canc /// /// /// Operation Id - /// FirewallRules_Get + /// RedisFirewallRule_Get /// /// /// Default Api Version @@ -332,11 +332,11 @@ public virtual async Task> ExistsAsync(string ruleName, Cancellat { Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleCollection.Exists"); + using var scope = _redisFirewallRuleClientDiagnostics.CreateScope("RedisFirewallRuleCollection.Exists"); scope.Start(); try { - var response = await _redisFirewallRuleFirewallRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _redisFirewallRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string ruleName, Cancellat /// /// /// Operation Id - /// FirewallRules_Get + /// RedisFirewallRule_Get /// /// /// Default Api Version @@ -375,11 +375,11 @@ public virtual Response Exists(string ruleName, CancellationToken cancella { Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleCollection.Exists"); + using var scope = _redisFirewallRuleClientDiagnostics.CreateScope("RedisFirewallRuleCollection.Exists"); scope.Start(); try { - var response = _redisFirewallRuleFirewallRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken: cancellationToken); + var response = _redisFirewallRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -398,7 +398,7 @@ public virtual Response Exists(string ruleName, CancellationToken cancella /// /// /// Operation Id - /// FirewallRules_Get + /// RedisFirewallRule_Get /// /// /// Default Api Version @@ -418,11 +418,11 @@ public virtual async Task> GetIfExis { Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleCollection.GetIfExists"); + using var scope = _redisFirewallRuleClientDiagnostics.CreateScope("RedisFirewallRuleCollection.GetIfExists"); scope.Start(); try { - var response = await _redisFirewallRuleFirewallRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _redisFirewallRuleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new RedisFirewallRuleResource(Client, response.Value), response.GetRawResponse()); @@ -443,7 +443,7 @@ public virtual async Task> GetIfExis /// /// /// Operation Id - /// FirewallRules_Get + /// RedisFirewallRule_Get /// /// /// Default Api Version @@ -463,11 +463,11 @@ public virtual NullableResponse GetIfExists(string ru { Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleCollection.GetIfExists"); + using var scope = _redisFirewallRuleClientDiagnostics.CreateScope("RedisFirewallRuleCollection.GetIfExists"); scope.Start(); try { - var response = _redisFirewallRuleFirewallRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken: cancellationToken); + var response = _redisFirewallRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ruleName, cancellationToken: cancellationToken); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new RedisFirewallRuleResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.Serialization.cs index 375f45260855..f1c32ef0b48e 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.Serialization.cs @@ -8,7 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Net; using System.Text; using System.Text.Json; using Azure.Core; @@ -41,9 +40,9 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("properties"u8); writer.WriteStartObject(); writer.WritePropertyName("startIP"u8); - writer.WriteStringValue(StartIP.ToString()); + writer.WriteStringValue(StartIP); writer.WritePropertyName("endIP"u8); - writer.WriteStringValue(EndIP.ToString()); + writer.WriteStringValue(EndIP); writer.WriteEndObject(); } @@ -71,8 +70,8 @@ internal static RedisFirewallRuleData DeserializeRedisFirewallRuleData(JsonEleme string name = default; ResourceType type = default; SystemData systemData = default; - IPAddress startIP = default; - IPAddress endIP = default; + string startIP = default; + string endIP = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -112,12 +111,12 @@ internal static RedisFirewallRuleData DeserializeRedisFirewallRuleData(JsonEleme { if (property0.NameEquals("startIP"u8)) { - startIP = IPAddress.Parse(property0.Value.GetString()); + startIP = property0.Value.GetString(); continue; } if (property0.NameEquals("endIP"u8)) { - endIP = IPAddress.Parse(property0.Value.GetString()); + endIP = property0.Value.GetString(); continue; } } @@ -139,107 +138,6 @@ internal static RedisFirewallRuleData DeserializeRedisFirewallRuleData(JsonEleme serializedAdditionalRawData); } - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Name)) - { - builder.Append(" name: "); - if (Name.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Name}'''"); - } - else - { - builder.AppendLine($"'{Name}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Id)) - { - builder.Append(" id: "); - builder.AppendLine($"'{Id.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" systemData: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SystemData)) - { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); - } - } - - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartIP), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" startIP: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(StartIP)) - { - builder.Append(" startIP: "); - builder.AppendLine($"'{StartIP.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndIP), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" endIP: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EndIP)) - { - builder.Append(" endIP: "); - builder.AppendLine($"'{EndIP.ToString()}'"); - } - } - - builder.AppendLine(" }"); - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -248,8 +146,6 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisFirewallRuleData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.cs index 033ec6f7f47e..1f61a43af024 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.cs @@ -7,7 +7,6 @@ using System; using System.Collections.Generic; -using System.Net; using Azure.Core; using Azure.ResourceManager.Models; @@ -49,13 +48,13 @@ public partial class RedisFirewallRuleData : ResourceData /// /// /// - private protected IDictionary _serializedAdditionalRawData; + private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . /// lowest IP address included in the range. /// highest IP address included in the range. /// or is null. - public RedisFirewallRuleData(IPAddress startIP, IPAddress endIP) + public RedisFirewallRuleData(string startIP, string endIP) { Argument.AssertNotNull(startIP, nameof(startIP)); Argument.AssertNotNull(endIP, nameof(endIP)); @@ -72,7 +71,7 @@ public RedisFirewallRuleData(IPAddress startIP, IPAddress endIP) /// lowest IP address included in the range. /// highest IP address included in the range. /// Keeps track of any properties unknown to the library. - internal RedisFirewallRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IPAddress startIP, IPAddress endIP, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal RedisFirewallRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string startIP, string endIP, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { StartIP = startIP; EndIP = endIP; @@ -85,10 +84,8 @@ internal RedisFirewallRuleData() } /// lowest IP address included in the range. - [WirePath("properties.startIP")] - public IPAddress StartIP { get; set; } + public string StartIP { get; set; } /// highest IP address included in the range. - [WirePath("properties.endIP")] - public IPAddress EndIP { get; set; } + public string EndIP { get; set; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleResource.cs index 3c291441b206..7473aa662e54 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleResource.cs @@ -33,8 +33,8 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _redisFirewallRuleFirewallRulesClientDiagnostics; - private readonly FirewallRulesRestOperations _redisFirewallRuleFirewallRulesRestClient; + private readonly ClientDiagnostics _redisFirewallRuleClientDiagnostics; + private readonly RedisFirewallRulesRestOperations _redisFirewallRuleRestClient; private readonly RedisFirewallRuleData _data; /// Gets the resource type for the operations. @@ -59,9 +59,9 @@ internal RedisFirewallRuleResource(ArmClient client, RedisFirewallRuleData data) /// The identifier of the resource that is the target of operations. internal RedisFirewallRuleResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _redisFirewallRuleFirewallRulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string redisFirewallRuleFirewallRulesApiVersion); - _redisFirewallRuleFirewallRulesRestClient = new FirewallRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisFirewallRuleFirewallRulesApiVersion); + _redisFirewallRuleClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string redisFirewallRuleApiVersion); + _redisFirewallRuleRestClient = new RedisFirewallRulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisFirewallRuleApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -97,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// FirewallRules_Get + /// RedisFirewallRule_Get /// /// /// Default Api Version @@ -112,11 +112,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleResource.Get"); + using var scope = _redisFirewallRuleClientDiagnostics.CreateScope("RedisFirewallRuleResource.Get"); scope.Start(); try { - var response = await _redisFirewallRuleFirewallRulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _redisFirewallRuleRestClient.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 RedisFirewallRuleResource(Client, response.Value), response.GetRawResponse()); @@ -137,7 +137,7 @@ public virtual async Task> GetAsync(Cancella /// /// /// Operation Id - /// FirewallRules_Get + /// RedisFirewallRule_Get /// /// /// Default Api Version @@ -152,11 +152,11 @@ public virtual async Task> GetAsync(Cancella /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleResource.Get"); + using var scope = _redisFirewallRuleClientDiagnostics.CreateScope("RedisFirewallRuleResource.Get"); scope.Start(); try { - var response = _redisFirewallRuleFirewallRulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _redisFirewallRuleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new RedisFirewallRuleResource(Client, response.Value), response.GetRawResponse()); @@ -177,7 +177,7 @@ public virtual Response Get(CancellationToken cancell /// /// /// Operation Id - /// FirewallRules_Delete + /// RedisFirewallRule_Delete /// /// /// Default Api Version @@ -193,12 +193,12 @@ public virtual Response Get(CancellationToken cancell /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleResource.Delete"); + using var scope = _redisFirewallRuleClientDiagnostics.CreateScope("RedisFirewallRuleResource.Delete"); scope.Start(); try { - var response = await _redisFirewallRuleFirewallRulesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _redisFirewallRuleFirewallRulesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + var response = await _redisFirewallRuleRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _redisFirewallRuleRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new RedisArmOperation(response, rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -221,7 +221,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// FirewallRules_Delete + /// RedisFirewallRule_Delete /// /// /// Default Api Version @@ -237,12 +237,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleResource.Delete"); + using var scope = _redisFirewallRuleClientDiagnostics.CreateScope("RedisFirewallRuleResource.Delete"); scope.Start(); try { - var response = _redisFirewallRuleFirewallRulesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var uri = _redisFirewallRuleFirewallRulesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + var response = _redisFirewallRuleRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var uri = _redisFirewallRuleRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new RedisArmOperation(response, rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -265,7 +265,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// FirewallRules_CreateOrUpdate + /// RedisFirewallRule_CreateOrUpdate /// /// /// Default Api Version @@ -285,12 +285,12 @@ public virtual async Task> UpdateAsync(W { Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleResource.Update"); + using var scope = _redisFirewallRuleClientDiagnostics.CreateScope("RedisFirewallRuleResource.Update"); scope.Start(); try { - var response = await _redisFirewallRuleFirewallRulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var uri = _redisFirewallRuleFirewallRulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var response = await _redisFirewallRuleRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _redisFirewallRuleRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new RedisArmOperation(Response.FromValue(new RedisFirewallRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -313,7 +313,7 @@ public virtual async Task> UpdateAsync(W /// /// /// Operation Id - /// FirewallRules_CreateOrUpdate + /// RedisFirewallRule_CreateOrUpdate /// /// /// Default Api Version @@ -333,12 +333,12 @@ public virtual ArmOperation Update(WaitUntil waitUnti { Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisFirewallRuleFirewallRulesClientDiagnostics.CreateScope("RedisFirewallRuleResource.Update"); + using var scope = _redisFirewallRuleClientDiagnostics.CreateScope("RedisFirewallRuleResource.Update"); scope.Start(); try { - var response = _redisFirewallRuleFirewallRulesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var uri = _redisFirewallRuleFirewallRulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var response = _redisFirewallRuleRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _redisFirewallRuleRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new RedisArmOperation(Response.FromValue(new RedisFirewallRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyCollection.cs index f0c8bacba046..d7768b431fd8 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyCollection.cs @@ -74,7 +74,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// if the method should wait to return until the long-running operation has completed on the 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 linked server that is being added to the Redis cache. + /// The to use. /// Parameters supplied to the Create Linked server operation. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. @@ -123,7 +123,7 @@ public virtual async Task> C /// /// /// if the method should wait to return until the long-running operation has completed on the 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 linked server that is being added to the Redis cache. + /// The to use. /// Parameters supplied to the Create Linked server operation. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. @@ -159,7 +159,7 @@ public virtual ArmOperation CreateOrUpdat /// /// /// Operation Id - /// LinkedServer_Get + /// RedisLinkedServerWithProperties_Get /// /// /// Default Api Version @@ -171,7 +171,7 @@ public virtual ArmOperation CreateOrUpdat /// /// /// - /// The name of the linked server. + /// The name of the RedisLinkedServerWithProperties. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -204,7 +204,7 @@ public virtual async Task> GetAs /// /// /// Operation Id - /// LinkedServer_Get + /// RedisLinkedServerWithProperties_Get /// /// /// Default Api Version @@ -216,7 +216,7 @@ public virtual async Task> GetAs /// /// /// - /// The name of the linked server. + /// The name of the RedisLinkedServerWithProperties. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -249,7 +249,7 @@ public virtual Response Get(string linked /// /// /// Operation Id - /// LinkedServer_List + /// RedisLinkedServerWithProperties_List /// /// /// Default Api Version @@ -279,7 +279,7 @@ public virtual AsyncPageable GetAllAsync( /// /// /// Operation Id - /// LinkedServer_List + /// RedisLinkedServerWithProperties_List /// /// /// Default Api Version @@ -309,7 +309,7 @@ public virtual Pageable GetAll(Cancellati /// /// /// Operation Id - /// LinkedServer_Get + /// RedisLinkedServerWithProperties_Get /// /// /// Default Api Version @@ -321,7 +321,7 @@ public virtual Pageable GetAll(Cancellati /// /// /// - /// The name of the linked server. + /// The name of the RedisLinkedServerWithProperties. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -352,7 +352,7 @@ public virtual async Task> ExistsAsync(string linkedServerName, C /// /// /// Operation Id - /// LinkedServer_Get + /// RedisLinkedServerWithProperties_Get /// /// /// Default Api Version @@ -364,7 +364,7 @@ public virtual async Task> ExistsAsync(string linkedServerName, C /// /// /// - /// The name of the linked server. + /// The name of the RedisLinkedServerWithProperties. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -395,7 +395,7 @@ public virtual Response Exists(string linkedServerName, CancellationToken /// /// /// Operation Id - /// LinkedServer_Get + /// RedisLinkedServerWithProperties_Get /// /// /// Default Api Version @@ -407,7 +407,7 @@ public virtual Response Exists(string linkedServerName, CancellationToken /// /// /// - /// The name of the linked server. + /// The name of the RedisLinkedServerWithProperties. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -440,7 +440,7 @@ public virtual async Task /// /// Operation Id - /// LinkedServer_Get + /// RedisLinkedServerWithProperties_Get /// /// /// Default Api Version @@ -452,7 +452,7 @@ public virtual async Task /// /// - /// The name of the linked server. + /// The name of the RedisLinkedServerWithProperties. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.Serialization.cs index 8f8e83379337..f02ef820e7d6 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.Serialization.cs @@ -12,7 +12,6 @@ using System.Text.Json; using Azure.Core; using Azure.ResourceManager.Models; -using Azure.ResourceManager.Redis.Models; namespace Azure.ResourceManager.Redis { @@ -40,31 +39,6 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); - if (Optional.IsDefined(LinkedRedisCacheId)) - { - writer.WritePropertyName("linkedRedisCacheId"u8); - writer.WriteStringValue(LinkedRedisCacheId); - } - if (Optional.IsDefined(LinkedRedisCacheLocation)) - { - writer.WritePropertyName("linkedRedisCacheLocation"u8); - writer.WriteStringValue(LinkedRedisCacheLocation.Value); - } - if (Optional.IsDefined(ServerRole)) - { - writer.WritePropertyName("serverRole"u8); - writer.WriteStringValue(ServerRole.Value.ToSerialString()); - } - if (options.Format != "W" && Optional.IsDefined(GeoReplicatedPrimaryHostName)) - { - writer.WritePropertyName("geoReplicatedPrimaryHostName"u8); - writer.WriteStringValue(GeoReplicatedPrimaryHostName); - } - if (options.Format != "W" && Optional.IsDefined(PrimaryHostName)) - { - writer.WritePropertyName("primaryHostName"u8); - writer.WriteStringValue(PrimaryHostName); - } if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) { writer.WritePropertyName("provisioningState"u8); @@ -97,11 +71,6 @@ internal static RedisLinkedServerWithPropertyData DeserializeRedisLinkedServerWi string name = default; ResourceType type = default; SystemData systemData = default; - ResourceIdentifier linkedRedisCacheId = default; - AzureLocation? linkedRedisCacheLocation = default; - RedisLinkedServerRole? serverRole = default; - string geoReplicatedPrimaryHostName = default; - string primaryHostName = default; string provisioningState = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -140,43 +109,6 @@ internal static RedisLinkedServerWithPropertyData DeserializeRedisLinkedServerWi } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("linkedRedisCacheId"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - linkedRedisCacheId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("linkedRedisCacheLocation"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - linkedRedisCacheLocation = new AzureLocation(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("serverRole"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - serverRole = property0.Value.GetString().ToRedisLinkedServerRole(); - continue; - } - if (property0.NameEquals("geoReplicatedPrimaryHostName"u8)) - { - geoReplicatedPrimaryHostName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("primaryHostName"u8)) - { - primaryHostName = property0.Value.GetString(); - continue; - } if (property0.NameEquals("provisioningState"u8)) { provisioningState = property0.Value.GetString(); @@ -196,200 +128,10 @@ internal static RedisLinkedServerWithPropertyData DeserializeRedisLinkedServerWi name, type, systemData, - linkedRedisCacheId, - linkedRedisCacheLocation, - serverRole, - geoReplicatedPrimaryHostName, - primaryHostName, provisioningState, serializedAdditionalRawData); } - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Name)) - { - builder.Append(" name: "); - if (Name.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Name}'''"); - } - else - { - builder.AppendLine($"'{Name}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Id)) - { - builder.Append(" id: "); - builder.AppendLine($"'{Id.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" systemData: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SystemData)) - { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); - } - } - - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LinkedRedisCacheId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" linkedRedisCacheId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(LinkedRedisCacheId)) - { - builder.Append(" linkedRedisCacheId: "); - builder.AppendLine($"'{LinkedRedisCacheId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LinkedRedisCacheLocation), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" linkedRedisCacheLocation: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(LinkedRedisCacheLocation)) - { - builder.Append(" linkedRedisCacheLocation: "); - builder.AppendLine($"'{LinkedRedisCacheLocation.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServerRole), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" serverRole: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ServerRole)) - { - builder.Append(" serverRole: "); - builder.AppendLine($"'{ServerRole.Value.ToSerialString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GeoReplicatedPrimaryHostName), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" geoReplicatedPrimaryHostName: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(GeoReplicatedPrimaryHostName)) - { - builder.Append(" geoReplicatedPrimaryHostName: "); - if (GeoReplicatedPrimaryHostName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{GeoReplicatedPrimaryHostName}'''"); - } - else - { - builder.AppendLine($"'{GeoReplicatedPrimaryHostName}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrimaryHostName), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" primaryHostName: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PrimaryHostName)) - { - builder.Append(" primaryHostName: "); - if (PrimaryHostName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{PrimaryHostName}'''"); - } - else - { - builder.AppendLine($"'{PrimaryHostName}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" provisioningState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ProvisioningState)) - { - builder.Append(" provisioningState: "); - if (ProvisioningState.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ProvisioningState}'''"); - } - else - { - builder.AppendLine($"'{ProvisioningState}'"); - } - } - } - - builder.AppendLine(" }"); - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -398,8 +140,6 @@ BinaryData IPersistableModel.Write(ModelReade { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisLinkedServerWithPropertyData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.cs index 0c7d86c5f9fc..ba7b68f6f655 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.cs @@ -9,7 +9,6 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Models; -using Azure.ResourceManager.Redis.Models; namespace Azure.ResourceManager.Redis { @@ -52,7 +51,7 @@ public partial class RedisLinkedServerWithPropertyData : ResourceData private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public RedisLinkedServerWithPropertyData() + internal RedisLinkedServerWithPropertyData() { } @@ -61,41 +60,15 @@ public RedisLinkedServerWithPropertyData() /// The name. /// The resourceType. /// The systemData. - /// Fully qualified resourceId of the linked redis cache. - /// Location of the linked redis cache. - /// Role of the linked server. - /// The unchanging DNS name which will always point to current geo-primary cache among the linked redis caches for seamless Geo Failover experience. - /// The changing DNS name that resolves to the current geo-primary cache among the linked redis caches before or after the Geo Failover. /// Terminal state of the link between primary and secondary redis cache. /// Keeps track of any properties unknown to the library. - internal RedisLinkedServerWithPropertyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResourceIdentifier linkedRedisCacheId, AzureLocation? linkedRedisCacheLocation, RedisLinkedServerRole? serverRole, string geoReplicatedPrimaryHostName, string primaryHostName, string provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal RedisLinkedServerWithPropertyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - LinkedRedisCacheId = linkedRedisCacheId; - LinkedRedisCacheLocation = linkedRedisCacheLocation; - ServerRole = serverRole; - GeoReplicatedPrimaryHostName = geoReplicatedPrimaryHostName; - PrimaryHostName = primaryHostName; ProvisioningState = provisioningState; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Fully qualified resourceId of the linked redis cache. - [WirePath("properties.linkedRedisCacheId")] - public ResourceIdentifier LinkedRedisCacheId { get; set; } - /// Location of the linked redis cache. - [WirePath("properties.linkedRedisCacheLocation")] - public AzureLocation? LinkedRedisCacheLocation { get; set; } - /// Role of the linked server. - [WirePath("properties.serverRole")] - public RedisLinkedServerRole? ServerRole { get; set; } - /// The unchanging DNS name which will always point to current geo-primary cache among the linked redis caches for seamless Geo Failover experience. - [WirePath("properties.geoReplicatedPrimaryHostName")] - public string GeoReplicatedPrimaryHostName { get; } - /// The changing DNS name that resolves to the current geo-primary cache among the linked redis caches before or after the Geo Failover. - [WirePath("properties.primaryHostName")] - public string PrimaryHostName { get; } /// Terminal state of the link between primary and secondary redis cache. - [WirePath("properties.provisioningState")] public string ProvisioningState { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyResource.cs index d50c219eb3c2..c3712d75c164 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyResource.cs @@ -98,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// LinkedServer_Get + /// RedisLinkedServerWithProperties_Get /// /// /// Default Api Version @@ -138,7 +138,7 @@ public virtual async Task> GetAs /// /// /// Operation Id - /// LinkedServer_Get + /// RedisLinkedServerWithProperties_Get /// /// /// Default Api Version @@ -178,7 +178,7 @@ public virtual Response Get(CancellationT /// /// /// Operation Id - /// LinkedServer_Delete + /// RedisLinkedServerWithProperties_Delete /// /// /// Default Api Version @@ -220,7 +220,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// LinkedServer_Delete + /// RedisLinkedServerWithProperties_Delete /// /// /// Default Api Version diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleCollection.cs index 8ea3cc3d129f..1f9e53073d58 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleCollection.cs @@ -25,8 +25,8 @@ namespace Azure.ResourceManager.Redis /// public partial class RedisPatchScheduleCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _redisPatchSchedulePatchSchedulesClientDiagnostics; - private readonly PatchSchedulesRestOperations _redisPatchSchedulePatchSchedulesRestClient; + private readonly ClientDiagnostics _redisPatchScheduleClientDiagnostics; + private readonly RedisPatchSchedulesRestOperations _redisPatchScheduleRestClient; /// Initializes a new instance of the class for mocking. protected RedisPatchScheduleCollection() @@ -38,9 +38,9 @@ protected RedisPatchScheduleCollection() /// The identifier of the parent resource that is the target of operations. internal RedisPatchScheduleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _redisPatchSchedulePatchSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", RedisPatchScheduleResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(RedisPatchScheduleResource.ResourceType, out string redisPatchSchedulePatchSchedulesApiVersion); - _redisPatchSchedulePatchSchedulesRestClient = new PatchSchedulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisPatchSchedulePatchSchedulesApiVersion); + _redisPatchScheduleClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", RedisPatchScheduleResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(RedisPatchScheduleResource.ResourceType, out string redisPatchScheduleApiVersion); + _redisPatchScheduleRestClient = new RedisPatchSchedulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisPatchScheduleApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -61,7 +61,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// PatchSchedules_CreateOrUpdate + /// RedisPatchSchedule_CreateOrUpdate /// /// /// Default Api Version @@ -74,20 +74,20 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Default string modeled as parameter for auto generation to work correctly. + /// The name of the RedisPatchSchedule. /// Parameters to set the patching schedule for Redis cache. /// The cancellation token to use. /// is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, RedisPatchScheduleDefaultName defaultName, RedisPatchScheduleData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, DefaultName @default, RedisPatchScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleCollection.CreateOrUpdate"); + using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _redisPatchSchedulePatchSchedulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defaultName, data, cancellationToken).ConfigureAwait(false); - var uri = _redisPatchSchedulePatchSchedulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defaultName, data); + var response = await _redisPatchScheduleRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, data, cancellationToken).ConfigureAwait(false); + var uri = _redisPatchScheduleRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new RedisArmOperation(Response.FromValue(new RedisPatchScheduleResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -110,7 +110,7 @@ public virtual async Task> CreateOrUpda /// /// /// Operation Id - /// PatchSchedules_CreateOrUpdate + /// RedisPatchSchedule_CreateOrUpdate /// /// /// Default Api Version @@ -123,20 +123,20 @@ public virtual async Task> CreateOrUpda /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// Default string modeled as parameter for auto generation to work correctly. + /// The name of the RedisPatchSchedule. /// Parameters to set the patching schedule for Redis cache. /// The cancellation token to use. /// is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, RedisPatchScheduleDefaultName defaultName, RedisPatchScheduleData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, DefaultName @default, RedisPatchScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleCollection.CreateOrUpdate"); + using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleCollection.CreateOrUpdate"); scope.Start(); try { - var response = _redisPatchSchedulePatchSchedulesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defaultName, data, cancellationToken); - var uri = _redisPatchSchedulePatchSchedulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defaultName, data); + var response = _redisPatchScheduleRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, data, cancellationToken); + var uri = _redisPatchScheduleRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new RedisArmOperation(Response.FromValue(new RedisPatchScheduleResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -159,7 +159,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// /// /// Operation Id - /// PatchSchedules_Get + /// RedisPatchSchedule_Get /// /// /// Default Api Version @@ -171,15 +171,15 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// /// /// - /// Default string modeled as parameter for auto generation to work correctly. + /// The name of the RedisPatchSchedule. /// The cancellation token to use. - public virtual async Task> GetAsync(RedisPatchScheduleDefaultName defaultName, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(DefaultName @default, CancellationToken cancellationToken = default) { - using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleCollection.Get"); + using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleCollection.Get"); scope.Start(); try { - var response = await _redisPatchSchedulePatchSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defaultName, cancellationToken).ConfigureAwait(false); + var response = await _redisPatchScheduleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new RedisPatchScheduleResource(Client, response.Value), response.GetRawResponse()); @@ -200,7 +200,7 @@ public virtual async Task> GetAsync(RedisPa /// /// /// Operation Id - /// PatchSchedules_Get + /// RedisPatchSchedule_Get /// /// /// Default Api Version @@ -212,15 +212,15 @@ public virtual async Task> GetAsync(RedisPa /// /// /// - /// Default string modeled as parameter for auto generation to work correctly. + /// The name of the RedisPatchSchedule. /// The cancellation token to use. - public virtual Response Get(RedisPatchScheduleDefaultName defaultName, CancellationToken cancellationToken = default) + public virtual Response Get(DefaultName @default, CancellationToken cancellationToken = default) { - using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleCollection.Get"); + using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleCollection.Get"); scope.Start(); try { - var response = _redisPatchSchedulePatchSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defaultName, cancellationToken); + var response = _redisPatchScheduleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new RedisPatchScheduleResource(Client, response.Value), response.GetRawResponse()); @@ -241,7 +241,7 @@ public virtual Response Get(RedisPatchScheduleDefaul /// /// /// Operation Id - /// PatchSchedules_ListByRedisResource + /// RedisPatchSchedule_ListByRedisResource /// /// /// Default Api Version @@ -257,9 +257,9 @@ public virtual Response Get(RedisPatchScheduleDefaul /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _redisPatchSchedulePatchSchedulesRestClient.CreateListByRedisResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisPatchSchedulePatchSchedulesRestClient.CreateListByRedisResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisPatchScheduleResource(Client, RedisPatchScheduleData.DeserializeRedisPatchScheduleData(e)), _redisPatchSchedulePatchSchedulesClientDiagnostics, Pipeline, "RedisPatchScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisPatchScheduleRestClient.CreateListByRedisResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisPatchScheduleRestClient.CreateListByRedisResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisPatchScheduleResource(Client, RedisPatchScheduleData.DeserializeRedisPatchScheduleData(e)), _redisPatchScheduleClientDiagnostics, Pipeline, "RedisPatchScheduleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -271,7 +271,7 @@ public virtual AsyncPageable GetAllAsync(Cancellatio /// /// /// Operation Id - /// PatchSchedules_ListByRedisResource + /// RedisPatchSchedule_ListByRedisResource /// /// /// Default Api Version @@ -287,9 +287,9 @@ public virtual AsyncPageable GetAllAsync(Cancellatio /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _redisPatchSchedulePatchSchedulesRestClient.CreateListByRedisResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisPatchSchedulePatchSchedulesRestClient.CreateListByRedisResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisPatchScheduleResource(Client, RedisPatchScheduleData.DeserializeRedisPatchScheduleData(e)), _redisPatchSchedulePatchSchedulesClientDiagnostics, Pipeline, "RedisPatchScheduleCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisPatchScheduleRestClient.CreateListByRedisResourceRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisPatchScheduleRestClient.CreateListByRedisResourceNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisPatchScheduleResource(Client, RedisPatchScheduleData.DeserializeRedisPatchScheduleData(e)), _redisPatchScheduleClientDiagnostics, Pipeline, "RedisPatchScheduleCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -301,7 +301,7 @@ public virtual Pageable GetAll(CancellationToken can /// /// /// Operation Id - /// PatchSchedules_Get + /// RedisPatchSchedule_Get /// /// /// Default Api Version @@ -313,15 +313,15 @@ public virtual Pageable GetAll(CancellationToken can /// /// /// - /// Default string modeled as parameter for auto generation to work correctly. + /// The name of the RedisPatchSchedule. /// The cancellation token to use. - public virtual async Task> ExistsAsync(RedisPatchScheduleDefaultName defaultName, CancellationToken cancellationToken = default) + public virtual async Task> ExistsAsync(DefaultName @default, CancellationToken cancellationToken = default) { - using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleCollection.Exists"); + using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleCollection.Exists"); scope.Start(); try { - var response = await _redisPatchSchedulePatchSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defaultName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _redisPatchScheduleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -340,7 +340,7 @@ public virtual async Task> ExistsAsync(RedisPatchScheduleDefaultN /// /// /// Operation Id - /// PatchSchedules_Get + /// RedisPatchSchedule_Get /// /// /// Default Api Version @@ -352,15 +352,15 @@ public virtual async Task> ExistsAsync(RedisPatchScheduleDefaultN /// /// /// - /// Default string modeled as parameter for auto generation to work correctly. + /// The name of the RedisPatchSchedule. /// The cancellation token to use. - public virtual Response Exists(RedisPatchScheduleDefaultName defaultName, CancellationToken cancellationToken = default) + public virtual Response Exists(DefaultName @default, CancellationToken cancellationToken = default) { - using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleCollection.Exists"); + using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleCollection.Exists"); scope.Start(); try { - var response = _redisPatchSchedulePatchSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defaultName, cancellationToken: cancellationToken); + var response = _redisPatchScheduleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -379,7 +379,7 @@ public virtual Response Exists(RedisPatchScheduleDefaultName defaultName, /// /// /// Operation Id - /// PatchSchedules_Get + /// RedisPatchSchedule_Get /// /// /// Default Api Version @@ -391,15 +391,15 @@ public virtual Response Exists(RedisPatchScheduleDefaultName defaultName, /// /// /// - /// Default string modeled as parameter for auto generation to work correctly. + /// The name of the RedisPatchSchedule. /// The cancellation token to use. - public virtual async Task> GetIfExistsAsync(RedisPatchScheduleDefaultName defaultName, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(DefaultName @default, CancellationToken cancellationToken = default) { - using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleCollection.GetIfExists"); + using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleCollection.GetIfExists"); scope.Start(); try { - var response = await _redisPatchSchedulePatchSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defaultName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _redisPatchScheduleRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new RedisPatchScheduleResource(Client, response.Value), response.GetRawResponse()); @@ -420,7 +420,7 @@ public virtual async Task> GetIfExi /// /// /// Operation Id - /// PatchSchedules_Get + /// RedisPatchSchedule_Get /// /// /// Default Api Version @@ -432,15 +432,15 @@ public virtual async Task> GetIfExi /// /// /// - /// Default string modeled as parameter for auto generation to work correctly. + /// The name of the RedisPatchSchedule. /// The cancellation token to use. - public virtual NullableResponse GetIfExists(RedisPatchScheduleDefaultName defaultName, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(DefaultName @default, CancellationToken cancellationToken = default) { - using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleCollection.GetIfExists"); + using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleCollection.GetIfExists"); scope.Start(); try { - var response = _redisPatchSchedulePatchSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, defaultName, cancellationToken: cancellationToken); + var response = _redisPatchScheduleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, default, cancellationToken: cancellationToken); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new RedisPatchScheduleResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.Serialization.cs index 477acc23a88a..944c7e61b01a 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.Serialization.cs @@ -8,7 +8,6 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -42,7 +41,7 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri if (options.Format != "W" && Optional.IsDefined(Location)) { writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location.Value); + writer.WriteStringValue(Location); } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); @@ -76,23 +75,19 @@ internal static RedisPatchScheduleData DeserializeRedisPatchScheduleData(JsonEle { return null; } - AzureLocation? location = default; + string location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - IList scheduleEntries = default; + IList scheduleEntries = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - location = new AzureLocation(property.Value.GetString()); + location = property.Value.GetString(); continue; } if (property.NameEquals("id"u8)) @@ -130,10 +125,10 @@ internal static RedisPatchScheduleData DeserializeRedisPatchScheduleData(JsonEle { if (property0.NameEquals("scheduleEntries"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(RedisPatchScheduleSetting.DeserializeRedisPatchScheduleSetting(item, options)); + array.Add(ScheduleEntry.DeserializeScheduleEntry(item, options)); } scheduleEntries = array; continue; @@ -152,120 +147,11 @@ internal static RedisPatchScheduleData DeserializeRedisPatchScheduleData(JsonEle name, type, systemData, - location, scheduleEntries, + location, serializedAdditionalRawData); } - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Name)) - { - builder.Append(" name: "); - if (Name.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Name}'''"); - } - else - { - builder.AppendLine($"'{Name}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" location: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Location)) - { - builder.Append(" location: "); - builder.AppendLine($"'{Location.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Id)) - { - builder.Append(" id: "); - builder.AppendLine($"'{Id.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" systemData: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SystemData)) - { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); - } - } - - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScheduleEntries), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scheduleEntries: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(ScheduleEntries)) - { - if (ScheduleEntries.Any()) - { - builder.Append(" scheduleEntries: "); - builder.AppendLine("["); - foreach (var item in ScheduleEntries) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " scheduleEntries: "); - } - builder.AppendLine(" ]"); - } - } - } - - builder.AppendLine(" }"); - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -274,8 +160,6 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisPatchScheduleData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.cs index 5f983f373140..406eb492c9f6 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.cs @@ -55,7 +55,7 @@ public partial class RedisPatchScheduleData : ResourceData /// Initializes a new instance of . /// List of patch schedules for a Redis cache. /// is null. - public RedisPatchScheduleData(IEnumerable scheduleEntries) + public RedisPatchScheduleData(IEnumerable scheduleEntries) { Argument.AssertNotNull(scheduleEntries, nameof(scheduleEntries)); @@ -67,13 +67,13 @@ public RedisPatchScheduleData(IEnumerable scheduleEnt /// The name. /// The resourceType. /// The systemData. - /// The geo-location where the resource lives. /// List of patch schedules for a Redis cache. + /// The geo-location where the resource lives. /// Keeps track of any properties unknown to the library. - internal RedisPatchScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, IList scheduleEntries, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal RedisPatchScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList scheduleEntries, string location, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - Location = location; ScheduleEntries = scheduleEntries; + Location = location; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -82,11 +82,9 @@ internal RedisPatchScheduleData() { } - /// The geo-location where the resource lives. - [WirePath("location")] - public AzureLocation? Location { get; } /// List of patch schedules for a Redis cache. - [WirePath("properties.scheduleEntries")] - public IList ScheduleEntries { get; } + public IList ScheduleEntries { get; } + /// The geo-location where the resource lives. + public string Location { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleResource.cs index 671ba1039eb2..41f0786a2d65 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleResource.cs @@ -27,15 +27,15 @@ public partial class RedisPatchScheduleResource : ArmResource /// The subscriptionId. /// The resourceGroupName. /// The name. - /// The defaultName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName defaultName) + /// The default. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, DefaultName @default) { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{defaultName}"; + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{@default}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _redisPatchSchedulePatchSchedulesClientDiagnostics; - private readonly PatchSchedulesRestOperations _redisPatchSchedulePatchSchedulesRestClient; + private readonly ClientDiagnostics _redisPatchScheduleClientDiagnostics; + private readonly RedisPatchSchedulesRestOperations _redisPatchScheduleRestClient; private readonly RedisPatchScheduleData _data; /// Gets the resource type for the operations. @@ -60,9 +60,9 @@ internal RedisPatchScheduleResource(ArmClient client, RedisPatchScheduleData dat /// The identifier of the resource that is the target of operations. internal RedisPatchScheduleResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _redisPatchSchedulePatchSchedulesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string redisPatchSchedulePatchSchedulesApiVersion); - _redisPatchSchedulePatchSchedulesRestClient = new PatchSchedulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisPatchSchedulePatchSchedulesApiVersion); + _redisPatchScheduleClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string redisPatchScheduleApiVersion); + _redisPatchScheduleRestClient = new RedisPatchSchedulesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisPatchScheduleApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -98,7 +98,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// PatchSchedules_Get + /// RedisPatchSchedule_Get /// /// /// Default Api Version @@ -113,11 +113,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleResource.Get"); + using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleResource.Get"); scope.Start(); try { - var response = await _redisPatchSchedulePatchSchedulesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _redisPatchScheduleRestClient.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 RedisPatchScheduleResource(Client, response.Value), response.GetRawResponse()); @@ -138,7 +138,7 @@ public virtual async Task> GetAsync(Cancell /// /// /// Operation Id - /// PatchSchedules_Get + /// RedisPatchSchedule_Get /// /// /// Default Api Version @@ -153,11 +153,11 @@ public virtual async Task> GetAsync(Cancell /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleResource.Get"); + using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleResource.Get"); scope.Start(); try { - var response = _redisPatchSchedulePatchSchedulesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _redisPatchScheduleRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new RedisPatchScheduleResource(Client, response.Value), response.GetRawResponse()); @@ -178,7 +178,7 @@ public virtual Response Get(CancellationToken cancel /// /// /// Operation Id - /// PatchSchedules_Delete + /// RedisPatchSchedule_Delete /// /// /// Default Api Version @@ -194,12 +194,12 @@ public virtual Response Get(CancellationToken cancel /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleResource.Delete"); + using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleResource.Delete"); scope.Start(); try { - var response = await _redisPatchSchedulePatchSchedulesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _redisPatchSchedulePatchSchedulesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + var response = await _redisPatchScheduleRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _redisPatchScheduleRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new RedisArmOperation(response, rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -222,7 +222,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// PatchSchedules_Delete + /// RedisPatchSchedule_Delete /// /// /// Default Api Version @@ -238,12 +238,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleResource.Delete"); + using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleResource.Delete"); scope.Start(); try { - var response = _redisPatchSchedulePatchSchedulesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var uri = _redisPatchSchedulePatchSchedulesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + var response = _redisPatchScheduleRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var uri = _redisPatchScheduleRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new RedisArmOperation(response, rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -266,7 +266,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// PatchSchedules_CreateOrUpdate + /// RedisPatchSchedule_CreateOrUpdate /// /// /// Default Api Version @@ -286,12 +286,12 @@ public virtual async Task> UpdateAsync( { Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleResource.Update"); + using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleResource.Update"); scope.Start(); try { - var response = await _redisPatchSchedulePatchSchedulesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var uri = _redisPatchSchedulePatchSchedulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var response = await _redisPatchScheduleRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _redisPatchScheduleRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new RedisArmOperation(Response.FromValue(new RedisPatchScheduleResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) @@ -314,7 +314,7 @@ public virtual async Task> UpdateAsync( /// /// /// Operation Id - /// PatchSchedules_CreateOrUpdate + /// RedisPatchSchedule_CreateOrUpdate /// /// /// Default Api Version @@ -334,12 +334,12 @@ public virtual ArmOperation Update(WaitUntil waitUnt { Argument.AssertNotNull(data, nameof(data)); - using var scope = _redisPatchSchedulePatchSchedulesClientDiagnostics.CreateScope("RedisPatchScheduleResource.Update"); + using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleResource.Update"); scope.Start(); try { - var response = _redisPatchSchedulePatchSchedulesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var uri = _redisPatchSchedulePatchSchedulesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var response = _redisPatchScheduleRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _redisPatchScheduleRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); var operation = new RedisArmOperation(Response.FromValue(new RedisPatchScheduleResource(Client, response), response.GetRawResponse()), rehydrationToken); if (waitUntil == WaitUntil.Completed) diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionCollection.cs index 0d5e18e56631..fffe3a0a5dcc 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionCollection.cs @@ -60,7 +60,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// PrivateEndpointConnections_Put + /// PrivateEndpointConnection_Put /// /// /// Default Api Version @@ -109,7 +109,7 @@ public virtual async Task> /// /// /// Operation Id - /// PrivateEndpointConnections_Put + /// PrivateEndpointConnection_Put /// /// /// Default Api Version @@ -158,7 +158,7 @@ public virtual ArmOperation CreateOrUpda /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -203,7 +203,7 @@ public virtual async Task> GetA /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -248,7 +248,7 @@ public virtual Response Get(string priva /// /// /// Operation Id - /// PrivateEndpointConnections_List + /// PrivateEndpointConnection_List /// /// /// Default Api Version @@ -265,7 +265,8 @@ public virtual Response Get(string priva public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _redisPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new RedisPrivateEndpointConnectionResource(Client, RedisPrivateEndpointConnectionData.DeserializeRedisPrivateEndpointConnectionData(e)), _redisPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "RedisPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisPrivateEndpointConnectionResource(Client, RedisPrivateEndpointConnectionData.DeserializeRedisPrivateEndpointConnectionData(e)), _redisPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "RedisPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -277,7 +278,7 @@ public virtual AsyncPageable GetAllAsync /// /// /// Operation Id - /// PrivateEndpointConnections_List + /// PrivateEndpointConnection_List /// /// /// Default Api Version @@ -294,7 +295,8 @@ public virtual AsyncPageable GetAllAsync public virtual Pageable GetAll(CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _redisPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new RedisPrivateEndpointConnectionResource(Client, RedisPrivateEndpointConnectionData.DeserializeRedisPrivateEndpointConnectionData(e)), _redisPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "RedisPrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisPrivateEndpointConnectionResource(Client, RedisPrivateEndpointConnectionData.DeserializeRedisPrivateEndpointConnectionData(e)), _redisPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "RedisPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -306,7 +308,7 @@ public virtual Pageable GetAll(Cancellat /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -349,7 +351,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -392,7 +394,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -437,7 +439,7 @@ public virtual async Task /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.Serialization.cs index 113afc78972d..ef9baefab588 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.Serialization.cs @@ -46,15 +46,15 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("privateEndpoint"u8); ((IJsonModel)PrivateEndpoint).Write(writer, options); } - if (Optional.IsDefined(RedisPrivateLinkServiceConnectionState)) + if (Optional.IsDefined(PrivateLinkServiceConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(RedisPrivateLinkServiceConnectionState, options); + writer.WriteObjectValue(PrivateLinkServiceConnectionState, options); } - if (options.Format != "W" && Optional.IsDefined(RedisProvisioningState)) + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) { writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(RedisProvisioningState.Value.ToString()); + writer.WriteStringValue(ProvisioningState.Value.ToString()); } writer.WriteEndObject(); } @@ -170,127 +170,6 @@ internal static RedisPrivateEndpointConnectionData DeserializeRedisPrivateEndpoi serializedAdditionalRawData); } - private BinaryData SerializeBicep(ModelReaderWriterOptions options) - { - StringBuilder builder = new StringBuilder(); - BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; - IDictionary propertyOverrides = null; - bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); - bool hasPropertyOverride = false; - string propertyOverride = null; - - builder.AppendLine("{"); - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Name)) - { - builder.Append(" name: "); - if (Name.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Name}'''"); - } - else - { - builder.AppendLine($"'{Name}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Id)) - { - builder.Append(" id: "); - builder.AppendLine($"'{Id.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" systemData: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SystemData)) - { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); - } - } - - builder.Append(" properties:"); - builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("PrivateEndpointId", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateEndpoint: "); - builder.AppendLine("{"); - builder.AppendLine(" privateEndpoint: {"); - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(PrivateEndpoint)) - { - builder.Append(" privateEndpoint: "); - BicepSerializationHelpers.AppendChildObject(builder, PrivateEndpoint, options, 4, false, " privateEndpoint: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RedisPrivateLinkServiceConnectionState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateLinkServiceConnectionState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RedisPrivateLinkServiceConnectionState)) - { - builder.Append(" privateLinkServiceConnectionState: "); - BicepSerializationHelpers.AppendChildObject(builder, RedisPrivateLinkServiceConnectionState, options, 4, false, " privateLinkServiceConnectionState: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RedisProvisioningState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" provisioningState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RedisProvisioningState)) - { - builder.Append(" provisioningState: "); - builder.AppendLine($"'{RedisProvisioningState.Value.ToString()}'"); - } - } - - builder.AppendLine(" }"); - builder.AppendLine("}"); - return BinaryData.FromString(builder.ToString()); - } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -299,8 +178,6 @@ BinaryData IPersistableModel.Write(ModelRead { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - case "bicep": - return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisPrivateEndpointConnectionData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.cs index 23525bec349c..429dd7c92468 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.cs @@ -62,32 +62,29 @@ public RedisPrivateEndpointConnectionData() /// The name. /// The resourceType. /// The systemData. - /// The resource of private end point. - /// A collection of information about the state of the connection between service consumer and provider. - /// The provisioning state of the private endpoint connection resource. + /// The private endpoint resource. + /// A collection of information about the state of the connection between service consumer and provider. + /// The provisioning state of the private endpoint connection resource. /// Keeps track of any properties unknown to the library. - internal RedisPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubResource privateEndpoint, RedisPrivateLinkServiceConnectionState redisPrivateLinkServiceConnectionState, RedisPrivateEndpointConnectionProvisioningState? redisProvisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal RedisPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubResource privateEndpoint, RedisPrivateLinkServiceConnectionState privateLinkServiceConnectionState, RedisPrivateEndpointConnectionProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { PrivateEndpoint = privateEndpoint; - RedisPrivateLinkServiceConnectionState = redisPrivateLinkServiceConnectionState; - RedisProvisioningState = redisProvisioningState; + PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + ProvisioningState = provisioningState; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The resource of private end point. + /// The private endpoint resource. internal SubResource PrivateEndpoint { get; set; } /// Gets Id. - [WirePath("properties.privateEndpoint.id")] public ResourceIdentifier PrivateEndpointId { get => PrivateEndpoint is null ? default : PrivateEndpoint.Id; } /// A collection of information about the state of the connection between service consumer and provider. - [WirePath("properties.privateLinkServiceConnectionState")] - public RedisPrivateLinkServiceConnectionState RedisPrivateLinkServiceConnectionState { get; set; } + public RedisPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } /// The provisioning state of the private endpoint connection resource. - [WirePath("properties.provisioningState")] - public RedisPrivateEndpointConnectionProvisioningState? RedisProvisioningState { get; } + public RedisPrivateEndpointConnectionProvisioningState? ProvisioningState { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionResource.cs index d430aeda86db..d33e0659f9b0 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionResource.cs @@ -97,7 +97,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -137,7 +137,7 @@ public virtual async Task> GetA /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -177,7 +177,7 @@ public virtual Response Get(Cancellation /// /// /// Operation Id - /// PrivateEndpointConnections_Delete + /// PrivateEndpointConnection_Delete /// /// /// Default Api Version @@ -221,7 +221,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// PrivateEndpointConnections_Delete + /// PrivateEndpointConnection_Delete /// /// /// Default Api Version @@ -265,7 +265,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// PrivateEndpointConnections_Put + /// PrivateEndpointConnection_Put /// /// /// Default Api Version @@ -311,7 +311,7 @@ public virtual async Task> /// /// /// Operation Id - /// PrivateEndpointConnections_Put + /// PrivateEndpointConnection_Put /// /// /// Default Api Version diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.Serialization.cs index 55f69a4f7802..d34f9d9448bb 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.Serialization.cs @@ -11,19 +11,19 @@ namespace Azure.ResourceManager.Redis { - public partial class RedisResource : IJsonModel + public partial class RedisResource : IJsonModel { - private static RedisData s_dataDeserializationInstance; - private static RedisData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static RedisResourceData s_dataDeserializationInstance; + private static RedisResourceData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - RedisData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + RedisResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerRedisContext.Default); + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerRedisContext.Default); - RedisData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerRedisContext.Default); + RedisResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerRedisContext.Default); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs index 272d460ece5d..31e376b49be5 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs @@ -13,17 +13,16 @@ using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.Models; using Azure.ResourceManager.Redis.Models; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.Redis { /// - /// A Class representing a Redis along with the instance operations that can be performed on it. + /// A Class representing a RedisResource 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 GetRedisResource method. - /// Otherwise you can get one from its parent resource using the GetRedis method. + /// Otherwise you can get one from its parent resource using the GetRedisResource method. /// public partial class RedisResource : ArmResource { @@ -37,11 +36,9 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _redisClientDiagnostics; - private readonly RedisRestOperations _redisRestClient; - private readonly ClientDiagnostics _privateLinkResourcesClientDiagnostics; - private readonly PrivateLinkResourcesRestOperations _privateLinkResourcesRestClient; - private readonly RedisData _data; + private readonly ClientDiagnostics _redisResourceClientDiagnostics; + private readonly RedisResourcesRestOperations _redisResourceRestClient; + private readonly RedisResourceData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.Cache/redis"; @@ -54,7 +51,7 @@ protected RedisResource() /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal RedisResource(ArmClient client, RedisData data) : this(client, data.Id) + internal RedisResource(ArmClient client, RedisResourceData data) : this(client, data.Id) { HasData = true; _data = data; @@ -65,11 +62,9 @@ internal RedisResource(ArmClient client, RedisData data) : this(client, data.Id) /// The identifier of the resource that is the target of operations. internal RedisResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _redisClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string redisApiVersion); - _redisRestClient = new RedisRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisApiVersion); - _privateLinkResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _privateLinkResourcesRestClient = new PrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _redisResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string redisResourceApiVersion); + _redisResourceRestClient = new RedisResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisResourceApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -80,7 +75,7 @@ internal RedisResource(ArmClient client, ResourceIdentifier id) : base(client, i /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual RedisData Data + public virtual RedisResourceData Data { get { @@ -96,7 +91,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of RedisFirewallRuleResources in the Redis. + /// Gets a collection of RedisFirewallRuleResources in the RedisResource. /// An object representing collection of RedisFirewallRuleResources and their operations over a RedisFirewallRuleResource. public virtual RedisFirewallRuleCollection GetRedisFirewallRules() { @@ -112,7 +107,7 @@ public virtual RedisFirewallRuleCollection GetRedisFirewallRules() /// /// /// Operation Id - /// FirewallRules_Get + /// RedisFirewallRule_Get /// /// /// Default Api Version @@ -143,7 +138,7 @@ public virtual async Task> GetRedisFirewallR /// /// /// Operation Id - /// FirewallRules_Get + /// RedisFirewallRule_Get /// /// /// Default Api Version @@ -165,7 +160,7 @@ public virtual Response GetRedisFirewallRule(string r return GetRedisFirewallRules().Get(ruleName, cancellationToken); } - /// Gets a collection of RedisPatchScheduleResources in the Redis. + /// Gets a collection of RedisPatchScheduleResources in the RedisResource. /// An object representing collection of RedisPatchScheduleResources and their operations over a RedisPatchScheduleResource. public virtual RedisPatchScheduleCollection GetRedisPatchSchedules() { @@ -181,7 +176,7 @@ public virtual RedisPatchScheduleCollection GetRedisPatchSchedules() /// /// /// Operation Id - /// PatchSchedules_Get + /// RedisPatchSchedule_Get /// /// /// Default Api Version @@ -193,12 +188,12 @@ public virtual RedisPatchScheduleCollection GetRedisPatchSchedules() /// /// /// - /// Default string modeled as parameter for auto generation to work correctly. + /// The name of the RedisPatchSchedule. /// The cancellation token to use. [ForwardsClientCalls] - public virtual async Task> GetRedisPatchScheduleAsync(RedisPatchScheduleDefaultName defaultName, CancellationToken cancellationToken = default) + public virtual async Task> GetRedisPatchScheduleAsync(DefaultName @default, CancellationToken cancellationToken = default) { - return await GetRedisPatchSchedules().GetAsync(defaultName, cancellationToken).ConfigureAwait(false); + return await GetRedisPatchSchedules().GetAsync(@default, cancellationToken).ConfigureAwait(false); } /// @@ -210,7 +205,7 @@ public virtual async Task> GetRedisPatchSch /// /// /// Operation Id - /// PatchSchedules_Get + /// RedisPatchSchedule_Get /// /// /// Default Api Version @@ -222,15 +217,15 @@ public virtual async Task> GetRedisPatchSch /// /// /// - /// Default string modeled as parameter for auto generation to work correctly. + /// The name of the RedisPatchSchedule. /// The cancellation token to use. [ForwardsClientCalls] - public virtual Response GetRedisPatchSchedule(RedisPatchScheduleDefaultName defaultName, CancellationToken cancellationToken = default) + public virtual Response GetRedisPatchSchedule(DefaultName @default, CancellationToken cancellationToken = default) { - return GetRedisPatchSchedules().Get(defaultName, cancellationToken); + return GetRedisPatchSchedules().Get(@default, cancellationToken); } - /// Gets a collection of RedisLinkedServerWithPropertyResources in the Redis. + /// Gets a collection of RedisLinkedServerWithPropertyResources in the RedisResource. /// An object representing collection of RedisLinkedServerWithPropertyResources and their operations over a RedisLinkedServerWithPropertyResource. public virtual RedisLinkedServerWithPropertyCollection GetRedisLinkedServerWithProperties() { @@ -246,7 +241,7 @@ public virtual RedisLinkedServerWithPropertyCollection GetRedisLinkedServerWithP /// /// /// Operation Id - /// LinkedServer_Get + /// RedisLinkedServerWithProperties_Get /// /// /// Default Api Version @@ -258,7 +253,7 @@ public virtual RedisLinkedServerWithPropertyCollection GetRedisLinkedServerWithP /// /// /// - /// The name of the linked server. + /// The name of the RedisLinkedServerWithProperties. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -277,7 +272,7 @@ public virtual async Task> GetRe /// /// /// Operation Id - /// LinkedServer_Get + /// RedisLinkedServerWithProperties_Get /// /// /// Default Api Version @@ -289,7 +284,7 @@ public virtual async Task> GetRe /// /// /// - /// The name of the linked server. + /// The name of the RedisLinkedServerWithProperties. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. @@ -299,7 +294,7 @@ public virtual Response GetRedisLinkedSer return GetRedisLinkedServerWithProperties().Get(linkedServerName, cancellationToken); } - /// Gets a collection of RedisPrivateEndpointConnectionResources in the Redis. + /// Gets a collection of RedisPrivateEndpointConnectionResources in the RedisResource. /// An object representing collection of RedisPrivateEndpointConnectionResources and their operations over a RedisPrivateEndpointConnectionResource. public virtual RedisPrivateEndpointConnectionCollection GetRedisPrivateEndpointConnections() { @@ -315,7 +310,7 @@ public virtual RedisPrivateEndpointConnectionCollection GetRedisPrivateEndpointC /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -346,7 +341,7 @@ public virtual async Task> GetR /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// PrivateEndpointConnection_Get /// /// /// Default Api Version @@ -368,7 +363,7 @@ public virtual Response GetRedisPrivateE return GetRedisPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); } - /// Gets a collection of RedisCacheAccessPolicyResources in the Redis. + /// Gets a collection of RedisCacheAccessPolicyResources in the RedisResource. /// An object representing collection of RedisCacheAccessPolicyResources and their operations over a RedisCacheAccessPolicyResource. public virtual RedisCacheAccessPolicyCollection GetRedisCacheAccessPolicies() { @@ -384,7 +379,7 @@ public virtual RedisCacheAccessPolicyCollection GetRedisCacheAccessPolicies() /// /// /// Operation Id - /// AccessPolicy_Get + /// RedisCacheAccessPolicy_Get /// /// /// Default Api Version @@ -415,7 +410,7 @@ public virtual async Task> GetRedisCach /// /// /// Operation Id - /// AccessPolicy_Get + /// RedisCacheAccessPolicy_Get /// /// /// Default Api Version @@ -437,7 +432,7 @@ public virtual Response GetRedisCacheAccessPolic return GetRedisCacheAccessPolicies().Get(accessPolicyName, cancellationToken); } - /// Gets a collection of RedisCacheAccessPolicyAssignmentResources in the Redis. + /// Gets a collection of RedisCacheAccessPolicyAssignmentResources in the RedisResource. /// An object representing collection of RedisCacheAccessPolicyAssignmentResources and their operations over a RedisCacheAccessPolicyAssignmentResource. public virtual RedisCacheAccessPolicyAssignmentCollection GetRedisCacheAccessPolicyAssignments() { @@ -453,7 +448,7 @@ public virtual RedisCacheAccessPolicyAssignmentCollection GetRedisCacheAccessPol /// /// /// Operation Id - /// AccessPolicyAssignment_Get + /// RedisCacheAccessPolicyAssignment_Get /// /// /// Default Api Version @@ -484,7 +479,7 @@ public virtual async Task> Ge /// /// /// Operation Id - /// AccessPolicyAssignment_Get + /// RedisCacheAccessPolicyAssignment_Get /// /// /// Default Api Version @@ -515,7 +510,7 @@ public virtual Response GetRedisCacheA /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -530,11 +525,11 @@ public virtual Response GetRedisCacheA /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.Get"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Get"); scope.Start(); try { - var response = await _redisRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _redisResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new RedisResource(Client, response.Value), response.GetRawResponse()); @@ -555,7 +550,7 @@ public virtual async Task> GetAsync(CancellationToken ca /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -570,11 +565,11 @@ public virtual async Task> GetAsync(CancellationToken ca /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.Get"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Get"); scope.Start(); try { - var response = _redisRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _redisResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new RedisResource(Client, response.Value), response.GetRawResponse()); @@ -595,7 +590,7 @@ public virtual Response Get(CancellationToken cancellationToken = /// /// /// Operation Id - /// Redis_Delete + /// RedisResource_Delete /// /// /// Default Api Version @@ -611,12 +606,12 @@ public virtual Response Get(CancellationToken cancellationToken = /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.Delete"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Delete"); scope.Start(); try { - var response = await _redisRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new RedisArmOperation(_redisClientDiagnostics, Pipeline, _redisRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _redisResourceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(_redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -637,7 +632,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Operation Id - /// Redis_Delete + /// RedisResource_Delete /// /// /// Default Api Version @@ -653,12 +648,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.Delete"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Delete"); scope.Start(); try { - var response = _redisRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new RedisArmOperation(_redisClientDiagnostics, Pipeline, _redisRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _redisResourceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new RedisArmOperation(_redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -679,7 +674,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Operation Id - /// Redis_Update + /// RedisResource_Update /// /// /// Default Api Version @@ -695,16 +690,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// Parameters supplied to the Update Redis operation. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, RedisPatch patch, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, RedisResourcePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.Update"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Update"); scope.Start(); try { - var response = await _redisRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new RedisArmOperation(new RedisOperationSource(Client), _redisClientDiagnostics, Pipeline, _redisRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = await _redisResourceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new RedisResourceOperationSource(Client), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -725,7 +720,7 @@ public virtual async Task> UpdateAsync(WaitUntil wai /// /// /// Operation Id - /// Redis_Update + /// RedisResource_Update /// /// /// Default Api Version @@ -741,16 +736,16 @@ public virtual async Task> UpdateAsync(WaitUntil wai /// Parameters supplied to the Update Redis operation. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, RedisPatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, RedisResourcePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.Update"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Update"); scope.Start(); try { - var response = _redisRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - var operation = new RedisArmOperation(new RedisOperationSource(Client), _redisClientDiagnostics, Pipeline, _redisRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = _redisResourceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new RedisArmOperation(new RedisResourceOperationSource(Client), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -771,7 +766,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, RedisPatc /// /// /// Operation Id - /// Redis_ListUpgradeNotifications + /// RedisResources_ListUpgradeNotifications /// /// /// Default Api Version @@ -785,12 +780,12 @@ public virtual ArmOperation Update(WaitUntil waitUntil, RedisPatc /// /// how many minutes in past to look for upgrade notifications. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetUpgradeNotificationsAsync(double history, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable ListUpgradeNotificationsAsync(double history, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _redisRestClient.CreateListUpgradeNotificationsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisRestClient.CreateListUpgradeNotificationsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => RedisUpgradeNotification.DeserializeRedisUpgradeNotification(e), _redisClientDiagnostics, Pipeline, "RedisResource.GetUpgradeNotifications", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisResourceRestClient.CreateListUpgradeNotificationsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisResourceRestClient.CreateListUpgradeNotificationsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => UpgradeNotification.DeserializeUpgradeNotification(e), _redisResourceClientDiagnostics, Pipeline, "RedisResource.ListUpgradeNotifications", "value", "nextLink", cancellationToken); } /// @@ -802,7 +797,7 @@ public virtual AsyncPageable GetUpgradeNotificationsAs /// /// /// Operation Id - /// Redis_ListUpgradeNotifications + /// RedisResources_ListUpgradeNotifications /// /// /// Default Api Version @@ -816,12 +811,12 @@ public virtual AsyncPageable GetUpgradeNotificationsAs /// /// how many minutes in past to look for upgrade notifications. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetUpgradeNotifications(double history, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable ListUpgradeNotifications(double history, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _redisRestClient.CreateListUpgradeNotificationsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisRestClient.CreateListUpgradeNotificationsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => RedisUpgradeNotification.DeserializeRedisUpgradeNotification(e), _redisClientDiagnostics, Pipeline, "RedisResource.GetUpgradeNotifications", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisResourceRestClient.CreateListUpgradeNotificationsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisResourceRestClient.CreateListUpgradeNotificationsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => UpgradeNotification.DeserializeUpgradeNotification(e), _redisResourceClientDiagnostics, Pipeline, "RedisResource.ListUpgradeNotifications", "value", "nextLink", cancellationToken); } /// @@ -833,7 +828,7 @@ public virtual Pageable GetUpgradeNotifications(double /// /// /// Operation Id - /// Redis_ListKeys + /// RedisResources_ListKeys /// /// /// Default Api Version @@ -846,13 +841,13 @@ public virtual Pageable GetUpgradeNotifications(double /// /// /// The cancellation token to use. - public virtual async Task> GetKeysAsync(CancellationToken cancellationToken = default) + public virtual async Task> ListKeysAsync(CancellationToken cancellationToken = default) { - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.GetKeys"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ListKeys"); scope.Start(); try { - var response = await _redisRestClient.ListKeysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _redisResourceRestClient.ListKeysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -871,7 +866,7 @@ public virtual async Task> GetKeysAsync(CancellationTo /// /// /// Operation Id - /// Redis_ListKeys + /// RedisResources_ListKeys /// /// /// Default Api Version @@ -884,13 +879,13 @@ public virtual async Task> GetKeysAsync(CancellationTo /// /// /// The cancellation token to use. - public virtual Response GetKeys(CancellationToken cancellationToken = default) + public virtual Response ListKeys(CancellationToken cancellationToken = default) { - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.GetKeys"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ListKeys"); scope.Start(); try { - var response = _redisRestClient.ListKeys(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _redisResourceRestClient.ListKeys(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return response; } catch (Exception e) @@ -909,7 +904,7 @@ public virtual Response GetKeys(CancellationToken cancellationT /// /// /// Operation Id - /// Redis_RegenerateKey + /// RedisResources_RegenerateKey /// /// /// Default Api Version @@ -928,11 +923,11 @@ public virtual async Task> RegenerateKeyAsync(RedisReg { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.RegenerateKey"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.RegenerateKey"); scope.Start(); try { - var response = await _redisRestClient.RegenerateKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var response = await _redisResourceRestClient.RegenerateKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -951,7 +946,7 @@ public virtual async Task> RegenerateKeyAsync(RedisReg /// /// /// Operation Id - /// Redis_RegenerateKey + /// RedisResources_RegenerateKey /// /// /// Default Api Version @@ -970,11 +965,11 @@ public virtual Response RegenerateKey(RedisRegenerateKeyContent { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.RegenerateKey"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.RegenerateKey"); scope.Start(); try { - var response = _redisRestClient.RegenerateKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var response = _redisResourceRestClient.RegenerateKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); return response; } catch (Exception e) @@ -993,7 +988,7 @@ public virtual Response RegenerateKey(RedisRegenerateKeyContent /// /// /// Operation Id - /// Redis_ForceReboot + /// RedisResources_ForceReboot /// /// /// Default Api Version @@ -1008,15 +1003,15 @@ public virtual Response RegenerateKey(RedisRegenerateKeyContent /// Specifies which Redis node(s) to reboot. /// The cancellation token to use. /// is null. - public virtual async Task> ForceRebootAsync(RedisRebootContent content, CancellationToken cancellationToken = default) + public virtual async Task> ForceRebootAsync(RedisRebootContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.ForceReboot"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ForceReboot"); scope.Start(); try { - var response = await _redisRestClient.ForceRebootAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var response = await _redisResourceRestClient.ForceRebootAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -1035,7 +1030,7 @@ public virtual async Task> ForceRebootAsync(Red /// /// /// Operation Id - /// Redis_ForceReboot + /// RedisResources_ForceReboot /// /// /// Default Api Version @@ -1050,15 +1045,15 @@ public virtual async Task> ForceRebootAsync(Red /// Specifies which Redis node(s) to reboot. /// The cancellation token to use. /// is null. - public virtual Response ForceReboot(RedisRebootContent content, CancellationToken cancellationToken = default) + public virtual Response ForceReboot(RedisRebootContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.ForceReboot"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ForceReboot"); scope.Start(); try { - var response = _redisRestClient.ForceReboot(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var response = _redisResourceRestClient.ForceReboot(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); return response; } catch (Exception e) @@ -1077,7 +1072,7 @@ public virtual Response ForceReboot(RedisRebootContent c /// /// /// Operation Id - /// Redis_ImportData + /// RedisResources_ImportData /// /// /// Default Api Version @@ -1093,16 +1088,16 @@ public virtual Response ForceReboot(RedisRebootContent c /// Parameters for Redis import operation. /// The cancellation token to use. /// is null. - public virtual async Task ImportDataAsync(WaitUntil waitUntil, ImportRdbContent content, CancellationToken cancellationToken = default) + public virtual async Task ImportDataAsync(WaitUntil waitUntil, ImportRDBContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.ImportData"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ImportData"); scope.Start(); try { - var response = await _redisRestClient.ImportDataAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new RedisArmOperation(_redisClientDiagnostics, Pipeline, _redisRestClient.CreateImportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = await _redisResourceRestClient.ImportDataAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(_redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateImportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1123,7 +1118,7 @@ public virtual async Task ImportDataAsync(WaitUntil waitUntil, Imp /// /// /// Operation Id - /// Redis_ImportData + /// RedisResources_ImportData /// /// /// Default Api Version @@ -1139,16 +1134,16 @@ public virtual async Task ImportDataAsync(WaitUntil waitUntil, Imp /// Parameters for Redis import operation. /// The cancellation token to use. /// is null. - public virtual ArmOperation ImportData(WaitUntil waitUntil, ImportRdbContent content, CancellationToken cancellationToken = default) + public virtual ArmOperation ImportData(WaitUntil waitUntil, ImportRDBContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.ImportData"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ImportData"); scope.Start(); try { - var response = _redisRestClient.ImportData(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); - var operation = new RedisArmOperation(_redisClientDiagnostics, Pipeline, _redisRestClient.CreateImportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = _redisResourceRestClient.ImportData(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new RedisArmOperation(_redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateImportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -1169,7 +1164,7 @@ public virtual ArmOperation ImportData(WaitUntil waitUntil, ImportRdbContent con /// /// /// Operation Id - /// Redis_ExportData + /// RedisResources_ExportData /// /// /// Default Api Version @@ -1185,16 +1180,16 @@ public virtual ArmOperation ImportData(WaitUntil waitUntil, ImportRdbContent con /// Parameters for Redis export operation. /// The cancellation token to use. /// is null. - public virtual async Task ExportDataAsync(WaitUntil waitUntil, ExportRdbContent content, CancellationToken cancellationToken = default) + public virtual async Task ExportDataAsync(WaitUntil waitUntil, ExportRDBContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.ExportData"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ExportData"); scope.Start(); try { - var response = await _redisRestClient.ExportDataAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new RedisArmOperation(_redisClientDiagnostics, Pipeline, _redisRestClient.CreateExportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = await _redisResourceRestClient.ExportDataAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(_redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateExportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1215,7 +1210,7 @@ public virtual async Task ExportDataAsync(WaitUntil waitUntil, Exp /// /// /// Operation Id - /// Redis_ExportData + /// RedisResources_ExportData /// /// /// Default Api Version @@ -1231,16 +1226,16 @@ public virtual async Task ExportDataAsync(WaitUntil waitUntil, Exp /// Parameters for Redis export operation. /// The cancellation token to use. /// is null. - public virtual ArmOperation ExportData(WaitUntil waitUntil, ExportRdbContent content, CancellationToken cancellationToken = default) + public virtual ArmOperation ExportData(WaitUntil waitUntil, ExportRDBContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.ExportData"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ExportData"); scope.Start(); try { - var response = _redisRestClient.ExportData(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); - var operation = new RedisArmOperation(_redisClientDiagnostics, Pipeline, _redisRestClient.CreateExportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = _redisResourceRestClient.ExportData(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new RedisArmOperation(_redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateExportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -1261,7 +1256,7 @@ public virtual ArmOperation ExportData(WaitUntil waitUntil, ExportRdbContent con /// /// /// Operation Id - /// Redis_FlushCache + /// RedisResources_FlushCache /// /// /// Default Api Version @@ -1277,12 +1272,12 @@ public virtual ArmOperation ExportData(WaitUntil waitUntil, ExportRdbContent con /// The cancellation token to use. public virtual async Task> FlushCacheAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.FlushCache"); + using var scope = _redisResourceClientDiagnostics.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); + var response = await _redisResourceRestClient.FlushCacheAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new OperationStatusResultOperationSource(), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateFlushCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1303,7 +1298,7 @@ public virtual async Task> FlushCacheAsync(W /// /// /// Operation Id - /// Redis_FlushCache + /// RedisResources_FlushCache /// /// /// Default Api Version @@ -1319,12 +1314,12 @@ public virtual async Task> FlushCacheAsync(W /// The cancellation token to use. public virtual ArmOperation FlushCache(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.FlushCache"); + using var scope = _redisResourceClientDiagnostics.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); + var response = _redisResourceRestClient.FlushCache(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new RedisArmOperation(new OperationStatusResultOperationSource(), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateFlushCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -1345,20 +1340,25 @@ public virtual ArmOperation FlushCache(WaitUntil waitUnti /// /// /// Operation Id - /// PrivateLinkResources_ListByRedisCache + /// RedisResources_ListByRedisCache /// /// /// Default Api Version /// 2024-11-01 /// + /// + /// Resource + /// + /// /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPrivateLinkResourcesByRedisCacheAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable ListByRedisCacheAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListByRedisCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => RedisPrivateLinkResource.DeserializeRedisPrivateLinkResource(e), _privateLinkResourcesClientDiagnostics, Pipeline, "RedisResource.GetPrivateLinkResourcesByRedisCache", "value", null, cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisResourceRestClient.CreateListByRedisCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisResourceRestClient.CreateListByRedisCacheNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => RedisPrivateLinkResourceData.DeserializeRedisPrivateLinkResourceData(e), _redisResourceClientDiagnostics, Pipeline, "RedisResource.ListByRedisCache", "value", "nextLink", cancellationToken); } /// @@ -1370,20 +1370,25 @@ public virtual AsyncPageable GetPrivateLinkResourcesBy /// /// /// Operation Id - /// PrivateLinkResources_ListByRedisCache + /// RedisResources_ListByRedisCache /// /// /// Default Api Version /// 2024-11-01 /// + /// + /// Resource + /// + /// /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPrivateLinkResourcesByRedisCache(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable ListByRedisCache(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListByRedisCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => RedisPrivateLinkResource.DeserializeRedisPrivateLinkResource(e), _privateLinkResourcesClientDiagnostics, Pipeline, "RedisResource.GetPrivateLinkResourcesByRedisCache", "value", null, cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisResourceRestClient.CreateListByRedisCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisResourceRestClient.CreateListByRedisCacheNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => RedisPrivateLinkResourceData.DeserializeRedisPrivateLinkResourceData(e), _redisResourceClientDiagnostics, Pipeline, "RedisResource.ListByRedisCache", "value", "nextLink", cancellationToken); } /// @@ -1395,7 +1400,7 @@ public virtual Pageable GetPrivateLinkResourcesByRedis /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -1416,7 +1421,7 @@ public virtual async Task> AddTagAsync(string key, strin Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.AddTag"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.AddTag"); scope.Start(); try { @@ -1425,13 +1430,13 @@ public virtual async Task> AddTagAsync(string key, strin var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues[key] = value; await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _redisRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var originalResponse = await _redisResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return Response.FromValue(new RedisResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new RedisPatch(); + var patch = new RedisResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -1457,7 +1462,7 @@ public virtual async Task> AddTagAsync(string key, strin /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -1478,7 +1483,7 @@ public virtual Response AddTag(string key, string value, Cancella Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.AddTag"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.AddTag"); scope.Start(); try { @@ -1487,13 +1492,13 @@ public virtual Response AddTag(string key, string value, Cancella var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _redisRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var originalResponse = _redisResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return Response.FromValue(new RedisResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new RedisPatch(); + var patch = new RedisResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -1519,7 +1524,7 @@ public virtual Response AddTag(string key, string value, Cancella /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -1538,7 +1543,7 @@ public virtual async Task> SetTagsAsync(IDictionary> SetTagsAsync(IDictionary> SetTagsAsync(IDictionary /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -1595,7 +1600,7 @@ public virtual Response SetTags(IDictionary tags, { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.SetTags"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.SetTags"); scope.Start(); try { @@ -1605,13 +1610,13 @@ public virtual Response SetTags(IDictionary tags, var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.ReplaceWith(tags); GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _redisRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var originalResponse = _redisResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return Response.FromValue(new RedisResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new RedisPatch(); + var patch = new RedisResourcePatch(); patch.Tags.ReplaceWith(tags); var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); @@ -1633,7 +1638,7 @@ public virtual Response SetTags(IDictionary tags, /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -1652,7 +1657,7 @@ public virtual async Task> RemoveTagAsync(string key, Ca { Argument.AssertNotNull(key, nameof(key)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.RemoveTag"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.RemoveTag"); scope.Start(); try { @@ -1661,13 +1666,13 @@ public virtual async Task> RemoveTagAsync(string key, Ca var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.Remove(key); await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _redisRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var originalResponse = await _redisResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return Response.FromValue(new RedisResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new RedisPatch(); + var patch = new RedisResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -1693,7 +1698,7 @@ public virtual async Task> RemoveTagAsync(string key, Ca /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -1712,7 +1717,7 @@ public virtual Response RemoveTag(string key, CancellationToken c { Argument.AssertNotNull(key, nameof(key)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.RemoveTag"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.RemoveTag"); scope.Start(); try { @@ -1721,13 +1726,13 @@ public virtual Response RemoveTag(string key, CancellationToken c var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _redisRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var originalResponse = _redisResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return Response.FromValue(new RedisResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new RedisPatch(); + var patch = new RedisResourcePatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceCollection.cs similarity index 76% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCollection.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceCollection.cs index 51dd810f0e6d..cdb1fc1a90a6 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceCollection.cs @@ -22,26 +22,26 @@ 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 GetRedis method from an instance of . + /// To get a instance call the GetRedisResources method from an instance of . /// - public partial class RedisCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class RedisResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _redisClientDiagnostics; - private readonly RedisRestOperations _redisRestClient; + private readonly ClientDiagnostics _redisResourceClientDiagnostics; + private readonly RedisResourcesRestOperations _redisResourceRestClient; - /// Initializes a new instance of the class for mocking. - protected RedisCollection() + /// Initializes a new instance of the class for mocking. + protected RedisResourceCollection() { } - /// Initializes a new instance of the class. + /// 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 RedisCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal RedisResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _redisClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", RedisResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(RedisResource.ResourceType, out string redisApiVersion); - _redisRestClient = new RedisRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisApiVersion); + _redisResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", RedisResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(RedisResource.ResourceType, out string redisResourceApiVersion); + _redisResourceRestClient = new RedisResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisResourceApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -62,7 +62,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Operation Id - /// Redis_Create + /// RedisResources_Create /// /// /// Default Api Version @@ -75,22 +75,22 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// if the method should wait to return until the long-running operation has completed on the 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 Redis cache. + /// The to use. /// Parameters supplied to the Create Redis 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 name, RedisCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string name, RedisResourceCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisClientDiagnostics.CreateScope("RedisCollection.CreateOrUpdate"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _redisRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, name, content, cancellationToken).ConfigureAwait(false); - var operation = new RedisArmOperation(new RedisOperationSource(Client), _redisClientDiagnostics, Pipeline, _redisRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, content).Request, response, OperationFinalStateVia.Location); + var response = await _redisResourceRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, name, content, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new RedisResourceOperationSource(Client), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -111,7 +111,7 @@ public virtual async Task> CreateOrUpdateAsync(WaitU /// /// /// Operation Id - /// Redis_Create + /// RedisResources_Create /// /// /// Default Api Version @@ -124,22 +124,22 @@ public virtual async Task> CreateOrUpdateAsync(WaitU /// /// /// if the method should wait to return until the long-running operation has completed on the 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 Redis cache. + /// The to use. /// Parameters supplied to the Create Redis 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 name, RedisCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string name, RedisResourceCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisClientDiagnostics.CreateScope("RedisCollection.CreateOrUpdate"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.CreateOrUpdate"); scope.Start(); try { - var response = _redisRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, name, content, cancellationToken); - var operation = new RedisArmOperation(new RedisOperationSource(Client), _redisClientDiagnostics, Pipeline, _redisRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, content).Request, response, OperationFinalStateVia.Location); + var response = _redisResourceRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, name, content, cancellationToken); + var operation = new RedisArmOperation(new RedisResourceOperationSource(Client), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -160,7 +160,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, s /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -172,7 +172,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, s /// /// /// - /// The name of the Redis cache. + /// The name of the RedisResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -180,11 +180,11 @@ public virtual async Task> GetAsync(string name, Cancell { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _redisClientDiagnostics.CreateScope("RedisCollection.Get"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.Get"); scope.Start(); try { - var response = await _redisRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken).ConfigureAwait(false); + var response = await _redisResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new RedisResource(Client, response.Value), response.GetRawResponse()); @@ -205,7 +205,7 @@ public virtual async Task> GetAsync(string name, Cancell /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -217,7 +217,7 @@ public virtual async Task> GetAsync(string name, Cancell /// /// /// - /// The name of the Redis cache. + /// The name of the RedisResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -225,11 +225,11 @@ public virtual Response Get(string name, CancellationToken cancel { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _redisClientDiagnostics.CreateScope("RedisCollection.Get"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.Get"); scope.Start(); try { - var response = _redisRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken); + var response = _redisResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new RedisResource(Client, response.Value), response.GetRawResponse()); @@ -250,7 +250,7 @@ public virtual Response Get(string name, CancellationToken cancel /// /// /// Operation Id - /// Redis_ListByResourceGroup + /// RedisResource_ListByResourceGroup /// /// /// Default Api Version @@ -266,9 +266,9 @@ public virtual Response Get(string name, CancellationToken cancel /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _redisRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisData.DeserializeRedisData(e)), _redisClientDiagnostics, Pipeline, "RedisCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisResourceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisResourceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisResourceData.DeserializeRedisResourceData(e)), _redisResourceClientDiagnostics, Pipeline, "RedisResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -280,7 +280,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken cancel /// /// /// Operation Id - /// Redis_ListByResourceGroup + /// RedisResource_ListByResourceGroup /// /// /// Default Api Version @@ -296,9 +296,9 @@ public virtual AsyncPageable GetAllAsync(CancellationToken cancel /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _redisRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisData.DeserializeRedisData(e)), _redisClientDiagnostics, Pipeline, "RedisCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisResourceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisResourceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisResourceData.DeserializeRedisResourceData(e)), _redisResourceClientDiagnostics, Pipeline, "RedisResourceCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -310,7 +310,7 @@ public virtual Pageable GetAll(CancellationToken cancellationToke /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -322,7 +322,7 @@ public virtual Pageable GetAll(CancellationToken cancellationToke /// /// /// - /// The name of the Redis cache. + /// The name of the RedisResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -330,11 +330,11 @@ public virtual async Task> ExistsAsync(string name, CancellationT { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _redisClientDiagnostics.CreateScope("RedisCollection.Exists"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.Exists"); scope.Start(); try { - var response = await _redisRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _redisResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -353,7 +353,7 @@ public virtual async Task> ExistsAsync(string name, CancellationT /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -365,7 +365,7 @@ public virtual async Task> ExistsAsync(string name, CancellationT /// /// /// - /// The name of the Redis cache. + /// The name of the RedisResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -373,11 +373,11 @@ public virtual Response Exists(string name, CancellationToken cancellation { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _redisClientDiagnostics.CreateScope("RedisCollection.Exists"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.Exists"); scope.Start(); try { - var response = _redisRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + var response = _redisResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -396,7 +396,7 @@ public virtual Response Exists(string name, CancellationToken cancellation /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -408,7 +408,7 @@ public virtual Response Exists(string name, CancellationToken cancellation /// /// /// - /// The name of the Redis cache. + /// The name of the RedisResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -416,11 +416,11 @@ public virtual async Task> GetIfExistsAsync(stri { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _redisClientDiagnostics.CreateScope("RedisCollection.GetIfExists"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.GetIfExists"); scope.Start(); try { - var response = await _redisRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _redisResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new RedisResource(Client, response.Value), response.GetRawResponse()); @@ -441,7 +441,7 @@ public virtual async Task> GetIfExistsAsync(stri /// /// /// Operation Id - /// Redis_Get + /// RedisResource_Get /// /// /// Default Api Version @@ -453,7 +453,7 @@ public virtual async Task> GetIfExistsAsync(stri /// /// /// - /// The name of the Redis cache. + /// The name of the RedisResource. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// is null. @@ -461,11 +461,11 @@ public virtual NullableResponse GetIfExists(string name, Cancella { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _redisClientDiagnostics.CreateScope("RedisCollection.GetIfExists"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.GetIfExists"); scope.Start(); try { - var response = _redisRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + var response = _redisResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new RedisResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.Serialization.cs new file mode 100644 index 000000000000..c9c9e75b0e27 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.Serialization.cs @@ -0,0 +1,388 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Redis.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Redis +{ + public partial class RedisResourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RedisResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsCollectionDefined(Zones)) + { + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (var item in Zones) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + ((IJsonModel)Identity).Write(writer, ModelSerializationExtensions.WireV3Options); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(HostName)) + { + writer.WritePropertyName("hostName"u8); + writer.WriteStringValue(HostName); + } + if (options.Format != "W" && Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + if (options.Format != "W" && Optional.IsDefined(SslPort)) + { + writer.WritePropertyName("sslPort"u8); + writer.WriteNumberValue(SslPort.Value); + } + if (options.Format != "W" && Optional.IsDefined(AccessKeys)) + { + writer.WritePropertyName("accessKeys"u8); + writer.WriteObjectValue(AccessKeys, options); + } + if (options.Format != "W" && Optional.IsCollectionDefined(LinkedServers)) + { + writer.WritePropertyName("linkedServers"u8); + writer.WriteStartArray(); + foreach (var item in LinkedServers) + { + ((IJsonModel)item).Write(writer, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Instances)) + { + writer.WritePropertyName("instances"u8); + writer.WriteStartArray(); + foreach (var item in Instances) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(PrivateEndpointConnections)) + { + writer.WritePropertyName("privateEndpointConnections"u8); + writer.WriteStartArray(); + foreach (var item in PrivateEndpointConnections) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + RedisResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RedisResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRedisResourceData(document.RootElement, options); + } + + internal static RedisResourceData DeserializeRedisResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList zones = default; + ManagedServiceIdentity identity = default; + IReadOnlyDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + ProvisioningState? provisioningState = default; + string hostName = default; + int? port = default; + int? sslPort = default; + RedisAccessKeys accessKeys = default; + IReadOnlyList linkedServers = default; + IReadOnlyList instances = default; + IReadOnlyList privateEndpointConnections = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("zones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + zones = array; + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireV3Options, AzureResourceManagerRedisContext.Default); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(property.Value.GetRawText())), ModelSerializationExtensions.WireOptions, AzureResourceManagerRedisContext.Default); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("hostName"u8)) + { + hostName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("port"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + port = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("sslPort"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sslPort = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("accessKeys"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + accessKeys = RedisAccessKeys.DeserializeRedisAccessKeys(property0.Value, options); + continue; + } + if (property0.NameEquals("linkedServers"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ModelReaderWriter.Read(new BinaryData(Encoding.UTF8.GetBytes(item.GetRawText())), options, AzureResourceManagerRedisContext.Default)); + } + linkedServers = array; + continue; + } + if (property0.NameEquals("instances"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(RedisInstanceDetails.DeserializeRedisInstanceDetails(item, options)); + } + instances = array; + continue; + } + if (property0.NameEquals("privateEndpointConnections"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(RedisPrivateEndpointConnectionData.DeserializeRedisPrivateEndpointConnectionData(item, options)); + } + privateEndpointConnections = array; + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RedisResourceData( + id, + name, + type, + systemData, + provisioningState, + hostName, + port, + sslPort, + accessKeys, + linkedServers ?? new ChangeTrackingList(), + instances ?? new ChangeTrackingList(), + privateEndpointConnections ?? new ChangeTrackingList(), + zones ?? new ChangeTrackingList(), + identity, + tags ?? new ChangeTrackingDictionary(), + location, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + default: + throw new FormatException($"The model {nameof(RedisResourceData)} does not support writing '{options.Format}' format."); + } + } + + RedisResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRedisResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RedisResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.cs new file mode 100644 index 000000000000..2b8e32c35db0 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Redis.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Redis +{ + /// + /// A class representing the RedisResource data model. + /// A single Redis item in List or Get Operation. + /// + public partial class RedisResourceData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The geo-location where the resource lives. + internal RedisResourceData(AzureLocation location) + { + LinkedServers = new ChangeTrackingList(); + Instances = new ChangeTrackingList(); + PrivateEndpointConnections = new ChangeTrackingList(); + Zones = new ChangeTrackingList(); + Tags = new ChangeTrackingDictionary(); + Location = location; + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// 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. + /// The availability zones. + /// The managed service identities assigned to this resource. + /// Resource tags. + /// The geo-location where the resource lives. + /// Keeps track of any properties unknown to the library. + internal RedisResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ProvisioningState? provisioningState, string hostName, int? port, int? sslPort, RedisAccessKeys accessKeys, IReadOnlyList linkedServers, IReadOnlyList instances, IReadOnlyList privateEndpointConnections, IReadOnlyList zones, ManagedServiceIdentity identity, IReadOnlyDictionary tags, AzureLocation location, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ProvisioningState = provisioningState; + HostName = hostName; + Port = port; + SslPort = sslPort; + AccessKeys = accessKeys; + LinkedServers = linkedServers; + Instances = instances; + PrivateEndpointConnections = privateEndpointConnections; + Zones = zones; + Identity = identity; + Tags = tags; + Location = location; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RedisResourceData() + { + } + + /// Redis instance provisioning status. + public ProvisioningState? ProvisioningState { get; } + /// Redis host name. + public string HostName { get; } + /// Redis non-SSL port. + public int? Port { get; } + /// Redis SSL port. + public int? SslPort { get; } + /// The keys of the Redis cache - not set if this object is not the response to Create or Update redis cache. + public RedisAccessKeys AccessKeys { get; } + /// List of the linked servers associated with the cache. + public IReadOnlyList LinkedServers { get; } + /// List of the Redis instances associated with the cache. + public IReadOnlyList Instances { get; } + /// List of private endpoint connection associated with the specified redis cache. + public IReadOnlyList PrivateEndpointConnections { get; } + /// The availability zones. + public IReadOnlyList Zones { get; } + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; } + /// Resource tags. + public IReadOnlyDictionary Tags { get; } + /// The geo-location where the resource lives. + public AzureLocation Location { get; } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AsyncOperationStatusRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AsyncOperationStatusOperationGroupRestOperations.cs similarity index 69% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AsyncOperationStatusRestOperations.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AsyncOperationStatusOperationGroupRestOperations.cs index 7fc6d7aa630d..2ccdf9a70ced 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AsyncOperationStatusRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AsyncOperationStatusOperationGroupRestOperations.cs @@ -15,20 +15,20 @@ namespace Azure.ResourceManager.Redis { - internal partial class AsyncOperationStatusRestOperations + internal partial class AsyncOperationStatusOperationGroupRestOperations { private readonly TelemetryDetails _userAgent; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of AsyncOperationStatusRestOperations. + /// Initializes a new instance of AsyncOperationStatusOperationGroupRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. - public AsyncOperationStatusRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + public AsyncOperationStatusOperationGroupRestOperations(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"); @@ -36,7 +36,7 @@ public AsyncOperationStatusRestOperations(HttpPipeline pipeline, string applicat _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, AzureLocation location, string operationId) + internal RequestUriBuilder CreateGetRequestUri(string location, string operationId, string subscriptionId) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -50,7 +50,7 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, AzureLocat return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, AzureLocation location, string operationId) + internal HttpMessage CreateGetRequest(string location, string operationId, string subscriptionId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -71,26 +71,27 @@ internal HttpMessage CreateGetRequest(string subscriptionId, AzureLocation locat } /// For checking the ongoing status of an operation. - /// The ID of the target subscription. /// The location at which operation was triggered. /// The ID of asynchronous operation. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, AzureLocation location, string operationId, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string location, string operationId, string subscriptionId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateGetRequest(subscriptionId, location, operationId); + using var message = CreateGetRequest(location, operationId, subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - RedisOperationStatus value = default; + OperationStatus value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisOperationStatus.DeserializeRedisOperationStatus(document.RootElement); + value = OperationStatus.DeserializeOperationStatus(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -99,26 +100,27 @@ public async Task> GetAsync(string subscriptionId } /// For checking the ongoing status of an operation. - /// The ID of the target subscription. /// The location at which operation was triggered. /// The ID of asynchronous operation. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, AzureLocation location, string operationId, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string location, string operationId, string subscriptionId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateGetRequest(subscriptionId, location, operationId); + using var message = CreateGetRequest(location, operationId, subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - RedisOperationStatus value = default; + OperationStatus value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisOperationStatus.DeserializeRedisOperationStatus(document.RootElement); + value = OperationStatus.DeserializeOperationStatus(document.RootElement); return Response.FromValue(value, message.Response); } default: 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 eecc5406bf5e..375b542c551b 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/LinkedServerRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/LinkedServerRestOperations.cs @@ -25,8 +25,8 @@ internal partial class LinkedServerRestOperations /// Initializes a new instance of LinkedServerRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public LinkedServerRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { @@ -36,7 +36,7 @@ public LinkedServerRestOperations(HttpPipeline pipeline, string applicationId, U _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string name, string linkedServerName, RedisLinkedServerWithPropertyCreateOrUpdateContent content) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string name, string linkedServerName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -52,11 +52,11 @@ internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string name, string linkedServerName, RedisLinkedServerWithPropertyCreateOrUpdateContent content) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name, string linkedServerName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -70,73 +70,77 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; _userAgent.Apply(message); return message; } - /// Adds a linked server to the Redis cache (requires Premium SKU). - /// The ID of the target subscription. + /// Gets the detailed information about a linked server of a redis cache (requires Premium SKU). + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. - /// The name of the linked server that is being added to the Redis cache. - /// Parameters supplied to the Create Linked server operation. + /// The name of the redis cache. + /// The name of the RedisLinkedServerWithProperties. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task CreateAsync(string subscriptionId, string resourceGroupName, string name, string linkedServerName, RedisLinkedServerWithPropertyCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string name, string linkedServerName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNullOrEmpty(linkedServerName, nameof(linkedServerName)); - Argument.AssertNotNull(content, nameof(content)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, name, linkedServerName, content); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, linkedServerName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: - return message.Response; + { + RedisLinkedServerWithPropertyData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = RedisLinkedServerWithPropertyData.DeserializeRedisLinkedServerWithPropertyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((RedisLinkedServerWithPropertyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Adds a linked server to the Redis cache (requires Premium SKU). - /// The ID of the target subscription. + /// Gets the detailed information about a linked server of a redis cache (requires Premium SKU). + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. - /// The name of the linked server that is being added to the Redis cache. - /// Parameters supplied to the Create Linked server operation. + /// The name of the redis cache. + /// The name of the RedisLinkedServerWithProperties. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string name, string linkedServerName, RedisLinkedServerWithPropertyCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string name, string linkedServerName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNullOrEmpty(linkedServerName, nameof(linkedServerName)); - Argument.AssertNotNull(content, nameof(content)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, name, linkedServerName, content); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, linkedServerName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: - return message.Response; + { + RedisLinkedServerWithPropertyData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = RedisLinkedServerWithPropertyData.DeserializeRedisLinkedServerWithPropertyData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((RedisLinkedServerWithPropertyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string name, string linkedServerName) + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string name, string linkedServerName, RedisLinkedServerWithPropertyCreateOrUpdateContent content) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -152,11 +156,11 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string name, string linkedServerName) + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string name, string linkedServerName, RedisLinkedServerWithPropertyCreateOrUpdateContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -170,65 +174,73 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; _userAgent.Apply(message); return message; } - /// Deletes the linked server from a redis cache (requires Premium SKU). - /// The ID of the target subscription. + /// Adds a linked server to the Redis cache (requires Premium SKU). + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the redis cache. - /// The name of the linked server that is being added to the Redis cache. + /// The to use. + /// The to use. + /// Parameters supplied to the Create Linked server operation. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string name, string linkedServerName, CancellationToken cancellationToken = default) + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string name, string linkedServerName, RedisLinkedServerWithPropertyCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNullOrEmpty(linkedServerName, nameof(linkedServerName)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name, linkedServerName); + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, name, linkedServerName, content); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: + case 201: return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Deletes the linked server from a redis cache (requires Premium SKU). - /// The ID of the target subscription. + /// Adds a linked server to the Redis cache (requires Premium SKU). + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the redis cache. - /// The name of the linked server that is being added to the Redis cache. + /// The to use. + /// The to use. + /// Parameters supplied to the Create Linked server operation. /// The cancellation token to use. - /// , , or is null. + /// , , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string name, string linkedServerName, CancellationToken cancellationToken = default) + public Response Create(string subscriptionId, string resourceGroupName, string name, string linkedServerName, RedisLinkedServerWithPropertyCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNullOrEmpty(linkedServerName, nameof(linkedServerName)); + Argument.AssertNotNull(content, nameof(content)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name, linkedServerName); + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, name, linkedServerName, content); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: + case 201: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string name, string linkedServerName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string name, string linkedServerName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -244,11 +256,11 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name, string linkedServerName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string name, string linkedServerName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -261,72 +273,59 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(linkedServerName, 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 a linked server of a redis cache (requires Premium SKU). - /// The ID of the target subscription. + /// Deletes the linked server from a redis cache (requires Premium SKU). + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. - /// The name of the linked server. + /// The name of the RedisLinkedServerWithProperties. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string name, string linkedServerName, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string name, string linkedServerName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNullOrEmpty(linkedServerName, nameof(linkedServerName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, linkedServerName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name, linkedServerName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - RedisLinkedServerWithPropertyData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisLinkedServerWithPropertyData.DeserializeRedisLinkedServerWithPropertyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((RedisLinkedServerWithPropertyData)null, message.Response); + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Gets the detailed information about a linked server of a redis cache (requires Premium SKU). - /// The ID of the target subscription. + /// Deletes the linked server from a redis cache (requires Premium SKU). + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. - /// The name of the linked server. + /// The name of the RedisLinkedServerWithProperties. /// The cancellation token to use. /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string name, string linkedServerName, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string name, string linkedServerName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNullOrEmpty(linkedServerName, nameof(linkedServerName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, linkedServerName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name, linkedServerName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - RedisLinkedServerWithPropertyData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisLinkedServerWithPropertyData.DeserializeRedisLinkedServerWithPropertyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((RedisLinkedServerWithPropertyData)null, message.Response); + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } @@ -369,7 +368,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Gets the list of linked servers associated with this redis cache (requires Premium SKU). - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// The cancellation token to use. @@ -398,7 +397,7 @@ public async Task> ListAsync(strin } /// Gets the list of linked servers associated with this redis cache (requires Premium SKU). - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// The cancellation token to use. @@ -450,7 +449,7 @@ 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. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// The cancellation token to use. @@ -481,7 +480,7 @@ 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. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. /// The cancellation token to use. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/OperationsRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/OperationsRestOperations.cs new file mode 100644 index 000000000000..22141e6b26f7 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/OperationsRestOperations.cs @@ -0,0 +1,173 @@ +// 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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Redis.Models; + +namespace Azure.ResourceManager.Redis +{ + internal partial class OperationsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of OperationsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public OperationsRestOperations(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 ?? "2024-11-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri() + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Cache/operations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Cache/operations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List the operations for the provider. + /// The cancellation token to use. + public async Task> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the operations for the provider. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List the operations for the provider. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public async Task> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OperationListResult.DeserializeOperationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the operations for the provider. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OperationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OperationListResult.DeserializeOperationListResult(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/PrivateEndpointConnectionsRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index 1f0aef332918..e4a7c63ae67f 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -25,8 +25,8 @@ internal partial class PrivateEndpointConnectionsRestOperations /// Initializes a new instance of PrivateEndpointConnectionsRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) { @@ -36,7 +36,7 @@ public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string ap _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string cacheName) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -46,12 +46,13 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Cache/redis/", false); uri.AppendPath(cacheName, true); - uri.AppendPath("/privateEndpointConnections", false); + uri.AppendPath("/privateEndpointConnections/", false); + uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string cacheName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -64,7 +65,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Cache/redis/", false); uri.AppendPath(cacheName, true); - uri.AppendPath("/privateEndpointConnections", false); + uri.AppendPath("/privateEndpointConnections/", false); + uri.AppendPath(privateEndpointConnectionName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -72,65 +74,73 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro return message; } - /// List all the private endpoint connections associated with the redis cache. - /// The ID of the target subscription. + /// Gets the specified private endpoint connection associated with the redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. + /// The name of the private endpoint connection associated with the Azure resource. /// 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) + /// , , 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, cacheName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, privateEndpointConnectionName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - RedisPrivateEndpointConnectionListResult value = default; + RedisPrivateEndpointConnectionData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisPrivateEndpointConnectionListResult.DeserializeRedisPrivateEndpointConnectionListResult(document.RootElement); + value = RedisPrivateEndpointConnectionData.DeserializeRedisPrivateEndpointConnectionData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((RedisPrivateEndpointConnectionData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// List all the private endpoint connections associated with the redis cache. - /// The ID of the target subscription. + /// Gets the specified private endpoint connection associated with the redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. + /// The name of the private endpoint connection associated with the Azure resource. /// 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) + /// , , 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, cacheName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, privateEndpointConnectionName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - RedisPrivateEndpointConnectionListResult value = default; + RedisPrivateEndpointConnectionData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisPrivateEndpointConnectionListResult.DeserializeRedisPrivateEndpointConnectionListResult(document.RootElement); + value = RedisPrivateEndpointConnectionData.DeserializeRedisPrivateEndpointConnectionData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((RedisPrivateEndpointConnectionData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName) + internal RequestUriBuilder CreatePutRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName, RedisPrivateEndpointConnectionData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -146,11 +156,11 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName) + internal HttpMessage CreatePutRequest(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName, RedisPrivateEndpointConnectionData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -164,77 +174,73 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou 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, ModelSerializationExtensions.WireOptions); + request.Content = content; _userAgent.Apply(message); return message; } - /// Gets the specified private endpoint connection associated with the redis cache. - /// The ID of the target subscription. + /// Update the state of specified private endpoint connection associated with the redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the private endpoint connection associated with the Azure resource. + /// The private endpoint connection properties. /// The cancellation token to use. - /// , , or is null. + /// , , , 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) + public async Task PutAsync(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName, RedisPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, privateEndpointConnectionName); + using var message = CreatePutRequest(subscriptionId, resourceGroupName, cacheName, privateEndpointConnectionName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - RedisPrivateEndpointConnectionData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisPrivateEndpointConnectionData.DeserializeRedisPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((RedisPrivateEndpointConnectionData)null, message.Response); + case 201: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Gets the specified private endpoint connection associated with the redis cache. - /// The ID of the target subscription. + /// Update the state of specified private endpoint connection associated with the redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the private endpoint connection associated with the Azure resource. + /// The private endpoint connection properties. /// The cancellation token to use. - /// , , or is null. + /// , , , 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) + public Response Put(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName, RedisPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, privateEndpointConnectionName); + using var message = CreatePutRequest(subscriptionId, resourceGroupName, cacheName, privateEndpointConnectionName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - RedisPrivateEndpointConnectionData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisPrivateEndpointConnectionData.DeserializeRedisPrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((RedisPrivateEndpointConnectionData)null, message.Response); + case 201: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreatePutRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName, RedisPrivateEndpointConnectionData data) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -250,11 +256,11 @@ internal RequestUriBuilder CreatePutRequestUri(string subscriptionId, string res return uri; } - internal HttpMessage CreatePutRequest(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName, RedisPrivateEndpointConnectionData data) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -267,74 +273,65 @@ internal HttpMessage CreatePutRequest(string subscriptionId, string resourceGrou uri.AppendPath(privateEndpointConnectionName, 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, ModelSerializationExtensions.WireOptions); - request.Content = content; _userAgent.Apply(message); return message; } - /// Update the state of specified private endpoint connection associated with the redis cache. - /// The ID of the target subscription. + /// Deletes the specified private endpoint connection associated with the redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the private endpoint connection associated with the Azure resource. - /// The private endpoint connection properties. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public async Task PutAsync(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName, RedisPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreatePutRequest(subscriptionId, resourceGroupName, cacheName, privateEndpointConnectionName, data); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, privateEndpointConnectionName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: + case 204: return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Update the state of specified private endpoint connection associated with the redis cache. - /// The ID of the target subscription. + /// Deletes the specified private endpoint connection associated with the redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the private endpoint connection associated with the Azure resource. - /// The private endpoint connection properties. /// The cancellation token to use. - /// , , , or is null. + /// , , or is null. /// , , or is an empty string, and was expected to be non-empty. - public Response Put(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName, RedisPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreatePutRequest(subscriptionId, resourceGroupName, cacheName, privateEndpointConnectionName, data); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, privateEndpointConnectionName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: + case 204: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string cacheName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -344,17 +341,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Cache/redis/", false); uri.AppendPath(cacheName, true); - uri.AppendPath("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); + uri.AppendPath("/privateEndpointConnections", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string cacheName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -363,8 +359,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Cache/redis/", false); uri.AppendPath(cacheName, true); - uri.AppendPath("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); + uri.AppendPath("/privateEndpointConnections", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -372,55 +367,143 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG return message; } - /// Deletes the specified private endpoint connection associated with the redis cache. - /// The ID of the target subscription. + /// List all the private endpoint connections associated with the redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. - /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + /// , 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)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, privateEndpointConnectionName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, cacheName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + RedisPrivateEndpointConnectionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = RedisPrivateEndpointConnectionListResult.DeserializeRedisPrivateEndpointConnectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Deletes the specified private endpoint connection associated with the redis cache. - /// The ID of the target subscription. + /// List all the private endpoint connections associated with the redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. - /// The name of the private endpoint connection associated with the Azure resource. /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string cacheName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + /// , 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)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, privateEndpointConnectionName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, cacheName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + RedisPrivateEndpointConnectionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = RedisPrivateEndpointConnectionListResult.DeserializeRedisPrivateEndpointConnectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string cacheName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + 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; + } + + /// List all the private endpoint connections associated with the redis cache. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the 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: + { + RedisPrivateEndpointConnectionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = RedisPrivateEndpointConnectionListResult.DeserializeRedisPrivateEndpointConnectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all the private endpoint connections associated with the redis cache. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the 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: + { + RedisPrivateEndpointConnectionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = RedisPrivateEndpointConnectionListResult.DeserializeRedisPrivateEndpointConnectionListResult(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/PrivateLinkResourcesRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs deleted file mode 100644 index fc38ca79f2b0..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Redis.Models; - -namespace Azure.ResourceManager.Redis -{ - internal partial class PrivateLinkResourcesRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of PrivateLinkResourcesRestOperations. - /// 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 PrivateLinkResourcesRestOperations(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 ?? "2024-11-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListByRedisCacheRequestUri(string subscriptionId, string resourceGroupName, string cacheName) - { - 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("/privateLinkResources", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListByRedisCacheRequest(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("/privateLinkResources", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets the private link resources that need to be created for 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 cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByRedisCacheAsync(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 = CreateListByRedisCacheRequest(subscriptionId, resourceGroupName, cacheName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RedisPrivateLinkResourceListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisPrivateLinkResourceListResult.DeserializeRedisPrivateLinkResourceListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the private link resources that need to be created for 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 cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByRedisCache(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 = CreateListByRedisCacheRequest(subscriptionId, resourceGroupName, cacheName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RedisPrivateLinkResourceListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisPrivateLinkResourceListResult.DeserializeRedisPrivateLinkResourceListResult(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/RedisCacheAccessPoliciesRestOperations.cs similarity index 97% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AccessPolicyRestOperations.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisCacheAccessPoliciesRestOperations.cs index 91d434e754ef..cb053ae22204 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AccessPolicyRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisCacheAccessPoliciesRestOperations.cs @@ -15,20 +15,20 @@ namespace Azure.ResourceManager.Redis { - internal partial class AccessPolicyRestOperations + internal partial class RedisCacheAccessPoliciesRestOperations { private readonly TelemetryDetails _userAgent; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of AccessPolicyRestOperations. + /// Initializes a new instance of RedisCacheAccessPoliciesRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. - public AccessPolicyRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + public RedisCacheAccessPoliciesRestOperations(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"); @@ -36,7 +36,7 @@ public AccessPolicyRestOperations(HttpPipeline pipeline, string applicationId, U _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateCreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName, RedisCacheAccessPolicyData data) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -52,11 +52,11 @@ internal RequestUriBuilder CreateCreateUpdateRequestUri(string subscriptionId, s return uri; } - internal HttpMessage CreateCreateUpdateRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName, RedisCacheAccessPolicyData data) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -70,73 +70,77 @@ internal HttpMessage CreateCreateUpdateRequest(string subscriptionId, string res 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, ModelSerializationExtensions.WireOptions); - request.Content = content; _userAgent.Apply(message); return message; } - /// Adds an access policy to the redis cache. - /// The ID of the target subscription. + /// Gets the detailed information about an access policy of a redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the 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 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) + 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)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateUpdateRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: - return message.Response; + { + RedisCacheAccessPolicyData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, 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); } } - /// Adds an access policy to the redis cache. - /// The ID of the target subscription. + /// Gets the detailed information about an access policy of a redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the 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 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) + 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)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateUpdateRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: - return message.Response; + { + RedisCacheAccessPolicyData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + 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 RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName) + internal RequestUriBuilder CreateCreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName, RedisCacheAccessPolicyData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -152,11 +156,11 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName) + internal HttpMessage CreateCreateUpdateRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName, RedisCacheAccessPolicyData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -170,67 +174,73 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG 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, ModelSerializationExtensions.WireOptions); + request.Content = content; _userAgent.Apply(message); return message; } - /// Deletes the access policy from a redis cache. - /// The ID of the target subscription. + /// Adds an access policy to the redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the 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 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) + 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 = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName); + using var message = CreateCreateUpdateRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - case 204: + case 201: return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Deletes the access policy from a redis cache. - /// The ID of the target subscription. + /// Adds an access policy to the redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the 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 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) + 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 = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName); + using var message = CreateCreateUpdateRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - case 204: + case 201: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -246,11 +256,11 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -263,72 +273,61 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou 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. + /// Deletes the access policy from a redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the 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) + 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 = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName); + using var message = CreateDeleteRequest(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, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisCacheAccessPolicyData.DeserializeRedisCacheAccessPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((RedisCacheAccessPolicyData)null, message.Response); + case 202: + case 204: + return 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. + /// Deletes the access policy from a redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the 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) + 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 = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyName); + using var message = CreateDeleteRequest(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, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisCacheAccessPolicyData.DeserializeRedisCacheAccessPolicyData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((RedisCacheAccessPolicyData)null, message.Response); + case 202: + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } @@ -371,7 +370,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Gets the list of access policies associated with this redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. @@ -400,7 +399,7 @@ public async Task> ListAsync(string subscri } /// Gets the list of access policies associated with this redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. @@ -452,7 +451,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// 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 ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. @@ -483,7 +482,7 @@ public async Task> ListNextPageAsync(string /// 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 ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AccessPolicyAssignmentRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisCacheAccessPolicyAssignmentsRestOperations.cs similarity index 97% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AccessPolicyAssignmentRestOperations.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisCacheAccessPolicyAssignmentsRestOperations.cs index 76674451507c..d7ddf1f8f4ab 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AccessPolicyAssignmentRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisCacheAccessPolicyAssignmentsRestOperations.cs @@ -15,20 +15,20 @@ namespace Azure.ResourceManager.Redis { - internal partial class AccessPolicyAssignmentRestOperations + internal partial class RedisCacheAccessPolicyAssignmentsRestOperations { private readonly TelemetryDetails _userAgent; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of AccessPolicyAssignmentRestOperations. + /// Initializes a new instance of RedisCacheAccessPolicyAssignmentsRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. - public AccessPolicyAssignmentRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + public RedisCacheAccessPolicyAssignmentsRestOperations(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"); @@ -36,7 +36,7 @@ public AccessPolicyAssignmentRestOperations(HttpPipeline pipeline, string applic _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateCreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName, RedisCacheAccessPolicyAssignmentData data) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -52,11 +52,11 @@ internal RequestUriBuilder CreateCreateUpdateRequestUri(string subscriptionId, s return uri; } - internal HttpMessage CreateCreateUpdateRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName, RedisCacheAccessPolicyAssignmentData data) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -70,73 +70,77 @@ internal HttpMessage CreateCreateUpdateRequest(string subscriptionId, string res 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, ModelSerializationExtensions.WireOptions); - request.Content = content; _userAgent.Apply(message); return message; } - /// Adds the access policy assignment to the specified users. - /// The ID of the target subscription. + /// Gets the list of assignments for an access policy of a redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the 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 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) + 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)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateUpdateRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: - return message.Response; + { + RedisCacheAccessPolicyAssignmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, 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); } } - /// Adds the access policy assignment to the specified users. - /// The ID of the target subscription. + /// Gets the list of assignments for an access policy of a redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the 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 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) + 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)); - Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateUpdateRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName, data); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: - return message.Response; + { + RedisCacheAccessPolicyAssignmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + 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 RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName) + internal RequestUriBuilder CreateCreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName, RedisCacheAccessPolicyAssignmentData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -152,11 +156,11 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName) + internal HttpMessage CreateCreateUpdateRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName, RedisCacheAccessPolicyAssignmentData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -170,67 +174,73 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG 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, ModelSerializationExtensions.WireOptions); + request.Content = content; _userAgent.Apply(message); return message; } - /// Deletes the access policy assignment from a redis cache. - /// The ID of the target subscription. + /// Adds the access policy assignment to the specified users. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the 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 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) + 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 = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName); + using var message = CreateCreateUpdateRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - case 204: + case 201: return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Deletes the access policy assignment from a redis cache. - /// The ID of the target subscription. + /// Adds the access policy assignment to the specified users. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the 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 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) + 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 = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName); + using var message = CreateCreateUpdateRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - case 204: + case 201: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -246,11 +256,11 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string cacheName, string accessPolicyAssignmentName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -263,72 +273,61 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou 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. + /// Deletes the access policy assignment from a redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the 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) + 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 = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName); + using var message = CreateDeleteRequest(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, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisCacheAccessPolicyAssignmentData.DeserializeRedisCacheAccessPolicyAssignmentData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((RedisCacheAccessPolicyAssignmentData)null, message.Response); + case 202: + case 204: + return 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. + /// Deletes the access policy assignment from a redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the 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) + 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 = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, accessPolicyAssignmentName); + using var message = CreateDeleteRequest(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, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisCacheAccessPolicyAssignmentData.DeserializeRedisCacheAccessPolicyAssignmentData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((RedisCacheAccessPolicyAssignmentData)null, message.Response); + case 202: + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } @@ -371,7 +370,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro } /// Gets the list of access policy assignments associated with this redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. @@ -400,7 +399,7 @@ public async Task> ListAsync(stri } /// Gets the list of access policy assignments associated with this redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. @@ -452,7 +451,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// 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 ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. @@ -483,7 +482,7 @@ public async Task> ListNextPageAs /// 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 ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// 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/RedisFirewallRulesRestOperations.cs similarity index 97% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/FirewallRulesRestOperations.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisFirewallRulesRestOperations.cs index af3ee7099b0d..3cd291040a03 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/FirewallRulesRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisFirewallRulesRestOperations.cs @@ -15,20 +15,20 @@ namespace Azure.ResourceManager.Redis { - internal partial class FirewallRulesRestOperations + internal partial class RedisFirewallRulesRestOperations { private readonly TelemetryDetails _userAgent; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of FirewallRulesRestOperations. + /// Initializes a new instance of RedisFirewallRulesRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. - public FirewallRulesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + public RedisFirewallRulesRestOperations(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"); @@ -36,7 +36,7 @@ public FirewallRulesRestOperations(HttpPipeline pipeline, string applicationId, _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string cacheName) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string ruleName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -46,12 +46,13 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Cache/redis/", false); uri.AppendPath(cacheName, true); - uri.AppendPath("/firewallRules", false); + uri.AppendPath("/firewallRules/", false); + uri.AppendPath(ruleName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string cacheName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string cacheName, string ruleName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -64,7 +65,8 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Cache/redis/", false); uri.AppendPath(cacheName, true); - uri.AppendPath("/firewallRules", false); + uri.AppendPath("/firewallRules/", false); + uri.AppendPath(ruleName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -72,59 +74,67 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro return message; } - /// Gets all firewall rules in the specified redis cache. - /// The ID of the target subscription. + /// Gets a single firewall rule in a specified redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. + /// The name of the firewall rule. /// 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) + /// , , 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 ruleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, cacheName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, ruleName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - RedisFirewallRuleListResult value = default; + RedisFirewallRuleData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisFirewallRuleListResult.DeserializeRedisFirewallRuleListResult(document.RootElement); + value = RedisFirewallRuleData.DeserializeRedisFirewallRuleData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((RedisFirewallRuleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Gets all firewall rules in the specified redis cache. - /// The ID of the target subscription. + /// Gets a single firewall rule in a specified redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. + /// The name of the firewall rule. /// 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) + /// , , 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 ruleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, cacheName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, ruleName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - RedisFirewallRuleListResult value = default; + RedisFirewallRuleData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisFirewallRuleListResult.DeserializeRedisFirewallRuleListResult(document.RootElement); + value = RedisFirewallRuleData.DeserializeRedisFirewallRuleData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((RedisFirewallRuleData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -173,7 +183,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Create or update a redis cache firewall rule. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the firewall rule. @@ -207,7 +217,7 @@ public async Task> CreateOrUpdateAsync(string su } /// Create or update a redis cache firewall rule. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the firewall rule. @@ -240,7 +250,7 @@ public Response CreateOrUpdate(string subscriptionId, str } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string ruleName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string ruleName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -256,11 +266,11 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string cacheName, string ruleName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string cacheName, string ruleName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -273,78 +283,65 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(ruleName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Gets a single firewall rule in a specified redis cache. - /// The ID of the target subscription. + /// Deletes a single firewall rule in a specified redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the firewall rule. /// 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 ruleName, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string cacheName, string ruleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, ruleName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, ruleName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - RedisFirewallRuleData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisFirewallRuleData.DeserializeRedisFirewallRuleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((RedisFirewallRuleData)null, message.Response); + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Gets a single firewall rule in a specified redis cache. - /// The ID of the target subscription. + /// Deletes a single firewall rule in a specified redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The name of the firewall rule. /// 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 ruleName, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string cacheName, string ruleName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, cacheName, ruleName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, ruleName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - RedisFirewallRuleData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisFirewallRuleData.DeserializeRedisFirewallRuleData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((RedisFirewallRuleData)null, message.Response); + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string cacheName, string ruleName) + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string cacheName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -354,17 +351,16 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Cache/redis/", false); uri.AppendPath(cacheName, true); - uri.AppendPath("/firewallRules/", false); - uri.AppendPath(ruleName, true); + uri.AppendPath("/firewallRules", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string cacheName, string ruleName) + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string cacheName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -373,8 +369,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Cache/redis/", false); uri.AppendPath(cacheName, true); - uri.AppendPath("/firewallRules/", false); - uri.AppendPath(ruleName, true); + uri.AppendPath("/firewallRules", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -382,55 +377,59 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG return message; } - /// Deletes a single firewall rule in a specified redis cache. - /// The ID of the target subscription. + /// Gets all firewall rules in the specified redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. - /// The name of the firewall rule. /// 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 ruleName, CancellationToken cancellationToken = default) + /// , 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)); - Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, ruleName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, cacheName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + RedisFirewallRuleListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = RedisFirewallRuleListResult.DeserializeRedisFirewallRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Deletes a single firewall rule in a specified redis cache. - /// The ID of the target subscription. + /// Gets all firewall rules in the specified redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. - /// The name of the firewall rule. /// 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 ruleName, CancellationToken cancellationToken = default) + /// , 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)); - Argument.AssertNotNullOrEmpty(ruleName, nameof(ruleName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, cacheName, ruleName); + using var message = CreateListRequest(subscriptionId, resourceGroupName, cacheName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 204: - return message.Response; + { + RedisFirewallRuleListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = RedisFirewallRuleListResult.DeserializeRedisFirewallRuleListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } @@ -460,7 +459,7 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript /// Gets all firewall rules in the specified redis cache. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. @@ -491,7 +490,7 @@ public async Task> ListNextPageAsync(strin /// Gets all firewall rules in the specified redis cache. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisOperationGroupRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisOperationGroupRestOperations.cs new file mode 100644 index 000000000000..eb5b7d825e69 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisOperationGroupRestOperations.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Redis.Models; + +namespace Azure.ResourceManager.Redis +{ + internal partial class RedisOperationGroupRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of RedisOperationGroupRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public RedisOperationGroupRestOperations(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 ?? "2024-11-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateCheckNameAvailabilityRequestUri(string subscriptionId, CheckNameAvailabilityContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Cache/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, CheckNameAvailabilityContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Cache/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Checks that the redis cache name is valid and is not already in use. + /// The ID of the target subscription. The value must be an UUID. + /// The request body. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task CheckNameAvailabilityAsync(string subscriptionId, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCheckNameAvailabilityRequest(subscriptionId, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Checks that the redis cache name is valid and is not already in use. + /// The ID of the target subscription. The value must be an UUID. + /// The request body. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response CheckNameAvailability(string subscriptionId, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCheckNameAvailabilityRequest(subscriptionId, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PatchSchedulesRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisPatchSchedulesRestOperations.cs similarity index 89% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PatchSchedulesRestOperations.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisPatchSchedulesRestOperations.cs index 000eba107e8b..1c5574e7f7a4 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/PatchSchedulesRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisPatchSchedulesRestOperations.cs @@ -15,20 +15,20 @@ namespace Azure.ResourceManager.Redis { - internal partial class PatchSchedulesRestOperations + internal partial class RedisPatchSchedulesRestOperations { private readonly TelemetryDetails _userAgent; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of PatchSchedulesRestOperations. + /// Initializes a new instance of RedisPatchSchedulesRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. - public PatchSchedulesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + public RedisPatchSchedulesRestOperations(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"); @@ -36,7 +36,7 @@ public PatchSchedulesRestOperations(HttpPipeline pipeline, string applicationId, _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListByRedisResourceRequestUri(string subscriptionId, string resourceGroupName, string cacheName) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string name, DefaultName @default) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -45,13 +45,14 @@ internal RequestUriBuilder CreateListByRedisResourceRequestUri(string subscripti uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Cache/redis/", false); - uri.AppendPath(cacheName, true); - uri.AppendPath("/patchSchedules", false); + uri.AppendPath(name, true); + uri.AppendPath("/patchSchedules/", false); + uri.AppendPath(@default.ToString(), true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListByRedisResourceRequest(string subscriptionId, string resourceGroupName, string cacheName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name, DefaultName @default) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -63,8 +64,9 @@ internal HttpMessage CreateListByRedisResourceRequest(string subscriptionId, str uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Cache/redis/", false); - uri.AppendPath(cacheName, true); - uri.AppendPath("/patchSchedules", false); + uri.AppendPath(name, true); + uri.AppendPath("/patchSchedules/", false); + uri.AppendPath(@default.ToString(), true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -72,65 +74,71 @@ internal HttpMessage CreateListByRedisResourceRequest(string subscriptionId, str return message; } - /// Gets all patch schedules in the specified redis cache (there is only one). - /// The ID of the target subscription. + /// Gets the patching schedule of a redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the redis cache. + /// The name of the RedisPatchSchedule. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListByRedisResourceAsync(string subscriptionId, string resourceGroupName, string cacheName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string name, DefaultName @default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateListByRedisResourceRequest(subscriptionId, resourceGroupName, cacheName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, @default); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - RedisPatchScheduleListResult value = default; + RedisPatchScheduleData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisPatchScheduleListResult.DeserializeRedisPatchScheduleListResult(document.RootElement); + value = RedisPatchScheduleData.DeserializeRedisPatchScheduleData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((RedisPatchScheduleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Gets all patch schedules in the specified redis cache (there is only one). - /// The ID of the target subscription. + /// Gets the patching schedule of a redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the redis cache. + /// The name of the RedisPatchSchedule. /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListByRedisResource(string subscriptionId, string resourceGroupName, string cacheName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string name, DefaultName @default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateListByRedisResourceRequest(subscriptionId, resourceGroupName, cacheName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, @default); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - RedisPatchScheduleListResult value = default; + RedisPatchScheduleData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisPatchScheduleListResult.DeserializeRedisPatchScheduleListResult(document.RootElement); + value = RedisPatchScheduleData.DeserializeRedisPatchScheduleData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((RedisPatchScheduleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName defaultName, RedisPatchScheduleData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, DefaultName @default, RedisPatchScheduleData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -141,12 +149,12 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath("/providers/Microsoft.Cache/redis/", false); uri.AppendPath(name, true); uri.AppendPath("/patchSchedules/", false); - uri.AppendPath(defaultName.ToString(), true); + uri.AppendPath(@default.ToString(), true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName defaultName, RedisPatchScheduleData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string name, DefaultName @default, RedisPatchScheduleData data) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -160,7 +168,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath("/providers/Microsoft.Cache/redis/", false); uri.AppendPath(name, true); uri.AppendPath("/patchSchedules/", false); - uri.AppendPath(defaultName.ToString(), true); + uri.AppendPath(@default.ToString(), true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -173,22 +181,22 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r } /// Create or replace the patching schedule for Redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. - /// Default string modeled as parameter for auto generation to work correctly. + /// The name of the redis cache. + /// The name of the RedisPatchSchedule. /// Parameters to set the patching schedule for 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> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName defaultName, RedisPatchScheduleData data, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string name, DefaultName @default, RedisPatchScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, name, defaultName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, name, @default, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -206,22 +214,22 @@ public async Task> CreateOrUpdateAsync(string s } /// Create or replace the patching schedule for Redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. - /// Default string modeled as parameter for auto generation to work correctly. + /// The name of the redis cache. + /// The name of the RedisPatchSchedule. /// Parameters to set the patching schedule for Redis cache. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName defaultName, RedisPatchScheduleData data, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string name, DefaultName @default, RedisPatchScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, name, defaultName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, name, @default, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -238,7 +246,7 @@ public Response CreateOrUpdate(string subscriptionId, st } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName defaultName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string name, DefaultName @default) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -249,12 +257,12 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath("/providers/Microsoft.Cache/redis/", false); uri.AppendPath(name, true); uri.AppendPath("/patchSchedules/", false); - uri.AppendPath(defaultName.ToString(), true); + uri.AppendPath(@default.ToString(), true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName defaultName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string name, DefaultName @default) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -268,29 +276,28 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath("/providers/Microsoft.Cache/redis/", false); uri.AppendPath(name, true); uri.AppendPath("/patchSchedules/", false); - uri.AppendPath(defaultName.ToString(), true); + uri.AppendPath(@default.ToString(), true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } /// Deletes the patching schedule of a redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. - /// Default string modeled as parameter for auto generation to work correctly. + /// The name of the RedisPatchSchedule. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName defaultName, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string name, DefaultName @default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name, defaultName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name, @default); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -303,20 +310,20 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes the patching schedule of a redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the redis cache. - /// Default string modeled as parameter for auto generation to work correctly. + /// The name of the RedisPatchSchedule. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName defaultName, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string name, DefaultName @default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name, defaultName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, name, @default); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -328,7 +335,7 @@ public Response Delete(string subscriptionId, string resourceGroupName, string n } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName defaultName) + internal RequestUriBuilder CreateListByRedisResourceRequestUri(string subscriptionId, string resourceGroupName, string cacheName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -337,14 +344,13 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Cache/redis/", false); - uri.AppendPath(name, true); - uri.AppendPath("/patchSchedules/", false); - uri.AppendPath(defaultName.ToString(), true); + uri.AppendPath(cacheName, true); + uri.AppendPath("/patchSchedules", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName defaultName) + internal HttpMessage CreateListByRedisResourceRequest(string subscriptionId, string resourceGroupName, string cacheName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -356,9 +362,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Cache/redis/", false); - uri.AppendPath(name, true); - uri.AppendPath("/patchSchedules/", false); - uri.AppendPath(defaultName.ToString(), true); + uri.AppendPath(cacheName, true); + uri.AppendPath("/patchSchedules", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -366,65 +371,59 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou return message; } - /// Gets the patching schedule of a redis cache. - /// The ID of the target subscription. + /// Gets all patch schedules in the specified redis cache (there is only one). + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the redis cache. - /// Default string modeled as parameter for auto generation to work correctly. + /// 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> GetAsync(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName defaultName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByRedisResourceAsync(string subscriptionId, string resourceGroupName, string cacheName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, defaultName); + using var message = CreateListByRedisResourceRequest(subscriptionId, resourceGroupName, cacheName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - RedisPatchScheduleData value = default; + RedisPatchScheduleListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisPatchScheduleData.DeserializeRedisPatchScheduleData(document.RootElement); + value = RedisPatchScheduleListResult.DeserializeRedisPatchScheduleListResult(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((RedisPatchScheduleData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Gets the patching schedule of a redis cache. - /// The ID of the target subscription. + /// Gets all patch schedules in the specified redis cache (there is only one). + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the redis cache. - /// Default string modeled as parameter for auto generation to work correctly. + /// 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 Get(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName defaultName, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByRedisResource(string subscriptionId, string resourceGroupName, string cacheName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name, defaultName); + using var message = CreateListByRedisResourceRequest(subscriptionId, resourceGroupName, cacheName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - RedisPatchScheduleData value = default; + RedisPatchScheduleListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisPatchScheduleData.DeserializeRedisPatchScheduleData(document.RootElement); + value = RedisPatchScheduleListResult.DeserializeRedisPatchScheduleListResult(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((RedisPatchScheduleData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -454,7 +453,7 @@ 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. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. @@ -485,7 +484,7 @@ 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. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisResourcesRestOperations.cs similarity index 82% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisRestOperations.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisResourcesRestOperations.cs index e21a069421bc..4bf704c13c02 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisResourcesRestOperations.cs @@ -15,20 +15,20 @@ namespace Azure.ResourceManager.Redis { - internal partial class RedisRestOperations + internal partial class RedisResourcesRestOperations { private readonly TelemetryDetails _userAgent; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of RedisRestOperations. + /// Initializes a new instance of RedisResourcesRestOperations. /// The HTTP pipeline for sending and receiving REST requests and responses. /// The application id to use for user agent. - /// server parameter. - /// Api Version. + /// Service host. + /// The API version to use for this operation. /// or is null. - public RedisRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + public RedisResourcesRestOperations(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"); @@ -36,83 +36,7 @@ public RedisRestOperations(HttpPipeline pipeline, string applicationId, Uri endp _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateCheckNameAvailabilityRequestUri(string subscriptionId, RedisNameAvailabilityContent content) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Cache/CheckNameAvailability", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, RedisNameAvailabilityContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Cache/CheckNameAvailability", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// Checks that the redis cache name is valid and is not already in use. - /// 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. - /// is an empty string, and was expected to be non-empty. - public async Task CheckNameAvailabilityAsync(string subscriptionId, RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCheckNameAvailabilityRequest(subscriptionId, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Checks that the redis cache name is valid and is not already in use. - /// 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. - /// is an empty string, and was expected to be non-empty. - public Response CheckNameAvailability(string subscriptionId, RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateCheckNameAvailabilityRequest(subscriptionId, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListUpgradeNotificationsRequestUri(string subscriptionId, string resourceGroupName, string name, double history) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string name) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -122,13 +46,11 @@ internal RequestUriBuilder CreateListUpgradeNotificationsRequestUri(string subsc uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Cache/redis/", false); uri.AppendPath(name, true); - uri.AppendPath("/listUpgradeNotifications", false); uri.AppendQuery("api-version", _apiVersion, true); - uri.AppendQuery("history", history, true); return uri; } - internal HttpMessage CreateListUpgradeNotificationsRequest(string subscriptionId, string resourceGroupName, string name, double history) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -141,76 +63,76 @@ internal HttpMessage CreateListUpgradeNotificationsRequest(string subscriptionId uri.AppendPath(resourceGroupName, true); uri.AppendPath("/providers/Microsoft.Cache/redis/", false); uri.AppendPath(name, true); - uri.AppendPath("/listUpgradeNotifications", false); uri.AppendQuery("api-version", _apiVersion, true); - uri.AppendQuery("history", history, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Gets any upgrade notifications for a Redis cache. - /// The ID of the target subscription. + /// Gets a Redis cache (resource description). + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. - /// how many minutes in past to look for upgrade notifications. + /// The name of the RedisResource. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ListUpgradeNotificationsAsync(string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateListUpgradeNotificationsRequest(subscriptionId, resourceGroupName, name, history); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, name); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - RedisUpgradeNotificationListResponse value = default; + RedisResourceData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisUpgradeNotificationListResponse.DeserializeRedisUpgradeNotificationListResponse(document.RootElement); + value = RedisResourceData.DeserializeRedisResourceData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((RedisResourceData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Gets any upgrade notifications for a Redis cache. - /// The ID of the target subscription. + /// Gets a Redis cache (resource description). + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. - /// how many minutes in past to look for upgrade notifications. + /// The name of the RedisResource. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ListUpgradeNotifications(string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateListUpgradeNotificationsRequest(subscriptionId, resourceGroupName, name, history); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, name); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - RedisUpgradeNotificationListResponse value = default; + RedisResourceData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisUpgradeNotificationListResponse.DeserializeRedisUpgradeNotificationListResponse(document.RootElement); + value = RedisResourceData.DeserializeRedisResourceData(document.RootElement); return Response.FromValue(value, message.Response); } + case 404: + return Response.FromValue((RedisResourceData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string name, RedisCreateOrUpdateContent content) + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string name, RedisResourceCreateOrUpdateContent content) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -224,7 +146,7 @@ internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string name, RedisCreateOrUpdateContent content) + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string name, RedisResourceCreateOrUpdateContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -249,14 +171,14 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG } /// Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The to use. /// Parameters supplied to the Create Redis operation. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task CreateAsync(string subscriptionId, string resourceGroupName, string name, RedisCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string name, RedisResourceCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -276,14 +198,14 @@ public async Task CreateAsync(string subscriptionId, string resourceGr } /// Create or replace (overwrite/recreate, with potential downtime) an existing Redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The to use. /// Parameters supplied to the Create Redis operation. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string name, RedisCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public Response Create(string subscriptionId, string resourceGroupName, string name, RedisResourceCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -302,7 +224,7 @@ public Response Create(string subscriptionId, string resourceGroupName, string n } } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, RedisPatch patch) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, RedisResourcePatch patch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -316,7 +238,7 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string name, RedisPatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string name, RedisResourcePatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -341,14 +263,14 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG } /// Update an existing Redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the RedisResource. /// Parameters supplied to the Update Redis operation. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string name, RedisPatch patch, CancellationToken cancellationToken = default) + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string name, RedisResourcePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -368,14 +290,14 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr } /// Update an existing Redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the RedisResource. /// Parameters supplied to the Update Redis operation. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string name, RedisPatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string name, RedisResourcePatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -423,15 +345,14 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(name, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } /// Deletes a Redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the RedisResource. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -455,9 +376,9 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } /// Deletes a Redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the RedisResource. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -480,7 +401,7 @@ public Response Delete(string subscriptionId, string resourceGroupName, string n } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string name) + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -488,13 +409,12 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Cache/redis/", false); - uri.AppendPath(name, true); + uri.AppendPath("/providers/Microsoft.Cache/redis", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name) + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -505,8 +425,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.Cache/redis/", false); - uri.AppendPath(name, true); + uri.AppendPath("/providers/Microsoft.Cache/redis", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -514,82 +433,72 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou return message; } - /// Gets a Redis cache (resource description). - /// The ID of the target subscription. + /// Lists all Redis caches in a resource group. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the 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 name, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - RedisData value = default; + RedisListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisData.DeserializeRedisData(document.RootElement); + value = RedisListResult.DeserializeRedisListResult(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((RedisData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Gets a Redis cache (resource description). - /// The ID of the target subscription. + /// Lists all Redis caches in a resource group. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the 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 name, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, name); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - RedisData value = default; + RedisListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisData.DeserializeRedisData(document.RootElement); + value = RedisListResult.DeserializeRedisListResult(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((RedisData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) { 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.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -598,8 +507,6 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str 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.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; @@ -608,18 +515,16 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str return message; } - /// Lists all Redis caches in a resource group. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. + /// Gets all Redis caches in the specified subscription. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + using var message = CreateListBySubscriptionRequest(subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -635,18 +540,16 @@ public async Task> ListByResourceGroupAsync(string sub } } - /// Lists all Redis caches in a resource group. - /// The ID of the target subscription. - /// The name of the resource group. The name is case insensitive. + /// Gets all Redis caches in the specified subscription. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + using var message = CreateListBySubscriptionRequest(subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -662,18 +565,23 @@ public Response ListByResourceGroup(string subscriptionId, stri } } - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + internal RequestUriBuilder CreateListUpgradeNotificationsRequestUri(string subscriptionId, string resourceGroupName, string name, double history) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Cache/redis", false); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Cache/redis/", false); + uri.AppendPath(name, true); + uri.AppendPath("/listUpgradeNotifications", false); uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("history", history, true); return uri; } - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + internal HttpMessage CreateListUpgradeNotificationsRequest(string subscriptionId, string resourceGroupName, string name, double history) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -682,32 +590,42 @@ internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.Cache/redis", false); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Cache/redis/", false); + uri.AppendPath(name, true); + uri.AppendPath("/listUpgradeNotifications", false); uri.AppendQuery("api-version", _apiVersion, true); + uri.AppendQuery("history", history, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Gets all Redis caches in the specified subscription. - /// The ID of the target subscription. + /// Gets any upgrade notifications for a Redis cache. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the RedisResource. + /// how many minutes in past to look for upgrade notifications. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListUpgradeNotificationsAsync(string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateListBySubscriptionRequest(subscriptionId); + using var message = CreateListUpgradeNotificationsRequest(subscriptionId, resourceGroupName, name, history); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - RedisListResult value = default; + NotificationListResponse value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisListResult.DeserializeRedisListResult(document.RootElement); + value = NotificationListResponse.DeserializeNotificationListResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -715,24 +633,29 @@ public async Task> ListBySubscriptionAsync(string subs } } - /// Gets all Redis caches in the specified subscription. - /// The ID of the target subscription. + /// Gets any upgrade notifications for a Redis cache. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the RedisResource. + /// how many minutes in past to look for upgrade notifications. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListUpgradeNotifications(string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var message = CreateListBySubscriptionRequest(subscriptionId); + using var message = CreateListUpgradeNotificationsRequest(subscriptionId, resourceGroupName, name, history); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - RedisListResult value = default; + NotificationListResponse value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisListResult.DeserializeRedisListResult(document.RootElement); + value = NotificationListResponse.DeserializeNotificationListResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -777,9 +700,9 @@ internal HttpMessage CreateListKeysRequest(string subscriptionId, string resourc } /// Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the RedisResource. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -806,9 +729,9 @@ public async Task> ListKeysAsync(string subscriptionId } /// Retrieve a Redis cache's access keys. This operation requires write permission to the cache resource. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the RedisResource. /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. @@ -875,9 +798,9 @@ internal HttpMessage CreateRegenerateKeyRequest(string subscriptionId, string re } /// Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the RedisResource. /// Specifies which key to regenerate. /// The cancellation token to use. /// , , or is null. @@ -906,9 +829,9 @@ public async Task> RegenerateKeyAsync(string subscript } /// Regenerate Redis cache's access keys. This operation requires write permission to the cache resource. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the RedisResource. /// Specifies which key to regenerate. /// The cancellation token to use. /// , , or is null. @@ -977,14 +900,14 @@ 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. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the RedisResource. /// Specifies which Redis node(s) to reboot. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ForceRebootAsync(string subscriptionId, string resourceGroupName, string name, RedisRebootContent content, CancellationToken cancellationToken = default) + public async Task> ForceRebootAsync(string subscriptionId, string resourceGroupName, string name, RedisRebootContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -997,9 +920,9 @@ public async Task> ForceRebootAsync(string subs { case 200: { - RedisForceRebootResult value = default; + RedisForceRebootResponse value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisForceRebootResult.DeserializeRedisForceRebootResult(document.RootElement); + value = RedisForceRebootResponse.DeserializeRedisForceRebootResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -1008,14 +931,14 @@ 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. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the RedisResource. /// Specifies which Redis node(s) to reboot. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ForceReboot(string subscriptionId, string resourceGroupName, string name, RedisRebootContent content, CancellationToken cancellationToken = default) + public Response ForceReboot(string subscriptionId, string resourceGroupName, string name, RedisRebootContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -1028,9 +951,9 @@ public Response ForceReboot(string subscriptionId, strin { case 200: { - RedisForceRebootResult value = default; + RedisForceRebootResponse value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisForceRebootResult.DeserializeRedisForceRebootResult(document.RootElement); + value = RedisForceRebootResponse.DeserializeRedisForceRebootResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -1038,7 +961,7 @@ public Response ForceReboot(string subscriptionId, strin } } - internal RequestUriBuilder CreateImportDataRequestUri(string subscriptionId, string resourceGroupName, string name, ImportRdbContent content) + internal RequestUriBuilder CreateImportDataRequestUri(string subscriptionId, string resourceGroupName, string name, ImportRDBContent content) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -1053,7 +976,7 @@ internal RequestUriBuilder CreateImportDataRequestUri(string subscriptionId, str return uri; } - internal HttpMessage CreateImportDataRequest(string subscriptionId, string resourceGroupName, string name, ImportRdbContent content) + internal HttpMessage CreateImportDataRequest(string subscriptionId, string resourceGroupName, string name, ImportRDBContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1069,7 +992,6 @@ internal HttpMessage CreateImportDataRequest(string subscriptionId, string resou uri.AppendPath("/import", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content0 = new Utf8JsonRequestContent(); content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); @@ -1079,14 +1001,14 @@ internal HttpMessage CreateImportDataRequest(string subscriptionId, string resou } /// Import data into Redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the RedisResource. /// Parameters for Redis import operation. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task ImportDataAsync(string subscriptionId, string resourceGroupName, string name, ImportRdbContent content, CancellationToken cancellationToken = default) + public async Task ImportDataAsync(string subscriptionId, string resourceGroupName, string name, ImportRDBContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -1107,14 +1029,14 @@ public async Task ImportDataAsync(string subscriptionId, string resour } /// Import data into Redis cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the RedisResource. /// Parameters for Redis import operation. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ImportData(string subscriptionId, string resourceGroupName, string name, ImportRdbContent content, CancellationToken cancellationToken = default) + public Response ImportData(string subscriptionId, string resourceGroupName, string name, ImportRDBContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -1134,7 +1056,7 @@ public Response ImportData(string subscriptionId, string resourceGroupName, stri } } - internal RequestUriBuilder CreateExportDataRequestUri(string subscriptionId, string resourceGroupName, string name, ExportRdbContent content) + internal RequestUriBuilder CreateExportDataRequestUri(string subscriptionId, string resourceGroupName, string name, ExportRDBContent content) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -1149,7 +1071,7 @@ internal RequestUriBuilder CreateExportDataRequestUri(string subscriptionId, str return uri; } - internal HttpMessage CreateExportDataRequest(string subscriptionId, string resourceGroupName, string name, ExportRdbContent content) + internal HttpMessage CreateExportDataRequest(string subscriptionId, string resourceGroupName, string name, ExportRDBContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1165,7 +1087,6 @@ internal HttpMessage CreateExportDataRequest(string subscriptionId, string resou uri.AppendPath("/export", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; - request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); var content0 = new Utf8JsonRequestContent(); content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); @@ -1175,14 +1096,14 @@ internal HttpMessage CreateExportDataRequest(string subscriptionId, string resou } /// Export data from the redis cache to blobs in a container. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the RedisResource. /// Parameters for Redis export operation. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task ExportDataAsync(string subscriptionId, string resourceGroupName, string name, ExportRdbContent content, CancellationToken cancellationToken = default) + public async Task ExportDataAsync(string subscriptionId, string resourceGroupName, string name, ExportRDBContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -1203,14 +1124,14 @@ public async Task ExportDataAsync(string subscriptionId, string resour } /// Export data from the redis cache to blobs in a container. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. + /// The name of the RedisResource. /// Parameters for Redis export operation. /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ExportData(string subscriptionId, string resourceGroupName, string name, ExportRdbContent content, CancellationToken cancellationToken = default) + public Response ExportData(string subscriptionId, string resourceGroupName, string name, ExportRDBContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -1267,7 +1188,7 @@ internal HttpMessage CreateFlushCacheRequest(string subscriptionId, string resou } /// Deletes all of the keys in a cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. @@ -1283,8 +1204,8 @@ public async Task FlushCacheAsync(string subscriptionId, string resour await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 200: case 202: + case 200: return message.Response; default: throw new RequestFailedException(message.Response); @@ -1292,7 +1213,7 @@ public async Task FlushCacheAsync(string subscriptionId, string resour } /// Deletes all of the keys in a cache. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the Redis cache. /// The cancellation token to use. @@ -1308,61 +1229,72 @@ public Response FlushCache(string subscriptionId, string resourceGroupName, stri _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 200: case 202: + case 200: return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListUpgradeNotificationsNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string name, double history) + internal RequestUriBuilder CreateListByRedisCacheRequestUri(string subscriptionId, string resourceGroupName, string cacheName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); + 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("/privateLinkResources", false); + uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListUpgradeNotificationsNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string name, double history) + internal HttpMessage CreateListByRedisCacheRequest(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); + 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("/privateLinkResources", false); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// Gets any upgrade notifications for a Redis cache. - /// The URL to the next page of results. - /// The ID of the target subscription. + /// Gets the private link resources that need to be created for a redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. - /// how many minutes in past to look for upgrade notifications. + /// 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> ListUpgradeNotificationsNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByRedisCacheAsync(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(name, nameof(name)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); - using var message = CreateListUpgradeNotificationsNextPageRequest(nextLink, subscriptionId, resourceGroupName, name, history); + using var message = CreateListByRedisCacheRequest(subscriptionId, resourceGroupName, cacheName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - RedisUpgradeNotificationListResponse value = default; + RedisPrivateLinkResourceListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisUpgradeNotificationListResponse.DeserializeRedisUpgradeNotificationListResponse(document.RootElement); + value = RedisPrivateLinkResourceListResult.DeserializeRedisPrivateLinkResourceListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -1370,31 +1302,28 @@ public async Task> ListUpgradeNot } } - /// Gets any upgrade notifications for a Redis cache. - /// The URL to the next page of results. - /// The ID of the target subscription. + /// Gets the private link resources that need to be created for a redis cache. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the Redis cache. - /// how many minutes in past to look for upgrade notifications. + /// 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 ListUpgradeNotificationsNextPage(string nextLink, string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByRedisCache(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(name, nameof(name)); + Argument.AssertNotNullOrEmpty(cacheName, nameof(cacheName)); - using var message = CreateListUpgradeNotificationsNextPageRequest(nextLink, subscriptionId, resourceGroupName, name, history); + using var message = CreateListByRedisCacheRequest(subscriptionId, resourceGroupName, cacheName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - RedisUpgradeNotificationListResponse value = default; + RedisPrivateLinkResourceListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisUpgradeNotificationListResponse.DeserializeRedisUpgradeNotificationListResponse(document.RootElement); + value = RedisPrivateLinkResourceListResult.DeserializeRedisPrivateLinkResourceListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -1426,7 +1355,7 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s /// Lists all Redis caches in a resource group. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. @@ -1455,7 +1384,7 @@ public async Task> ListByResourceGroupNextPageAsync(st /// Lists all Redis caches in a resource group. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The cancellation token to use. /// , or is null. @@ -1506,7 +1435,7 @@ internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, st /// Gets all Redis caches in the specified subscription. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -1533,7 +1462,7 @@ public async Task> ListBySubscriptionNextPageAsync(str /// Gets all Redis caches in the specified subscription. /// The URL to the next page of results. - /// The ID of the target subscription. + /// The ID of the target subscription. The value must be an UUID. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. @@ -1557,5 +1486,175 @@ public Response ListBySubscriptionNextPage(string nextLink, str throw new RequestFailedException(message.Response); } } + + internal RequestUriBuilder CreateListUpgradeNotificationsNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string name, double history) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListUpgradeNotificationsNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string name, double history) + { + 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 any upgrade notifications for a Redis cache. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the RedisResource. + /// how many minutes in past to look for upgrade notifications. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListUpgradeNotificationsNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var message = CreateListUpgradeNotificationsNextPageRequest(nextLink, subscriptionId, resourceGroupName, name, history); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + NotificationListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = NotificationListResponse.DeserializeNotificationListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets any upgrade notifications for a Redis cache. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the RedisResource. + /// how many minutes in past to look for upgrade notifications. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListUpgradeNotificationsNextPage(string nextLink, string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var message = CreateListUpgradeNotificationsNextPageRequest(nextLink, subscriptionId, resourceGroupName, name, history); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + NotificationListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = NotificationListResponse.DeserializeNotificationListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByRedisCacheNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string cacheName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByRedisCacheNextPageRequest(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 private link resources that need to be created for a redis cache. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the 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> ListByRedisCacheNextPageAsync(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 = CreateListByRedisCacheNextPageRequest(nextLink, subscriptionId, resourceGroupName, cacheName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RedisPrivateLinkResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = RedisPrivateLinkResourceListResult.DeserializeRedisPrivateLinkResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the private link resources that need to be created for a redis cache. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the Redis cache. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByRedisCacheNextPage(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 = CreateListByRedisCacheNextPageRequest(nextLink, subscriptionId, resourceGroupName, cacheName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RedisPrivateLinkResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = RedisPrivateLinkResourceListResult.DeserializeRedisPrivateLinkResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/autorest.md b/sdk/redis/Azure.ResourceManager.Redis/src/autorest.md.bak similarity index 96% rename from sdk/redis/Azure.ResourceManager.Redis/src/autorest.md rename to sdk/redis/Azure.ResourceManager.Redis/src/autorest.md.bak index 4ab3b398d110..914d1a8826c2 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/autorest.md +++ b/sdk/redis/Azure.ResourceManager.Redis/src/autorest.md.bak @@ -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/9069559e0fe5ed52b884ddc658fa539ec67c7ef8/specification/redis/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/b65edc10ae6d37b0709928eef8a693ceefe99358/specification/redis/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentCollection.cs deleted file mode 100644 index f8d771500278..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentCollection.cs +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using NUnit.Framework; - -namespace Azure.ResourceManager.Redis.Samples -{ - public partial class Sample_RedisCacheAccessPolicyAssignmentCollection - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_RedisCacheAccessPolicyAssignmentCreateUpdate() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Get_RedisCacheAccessPolicyAssignmentGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetAll_RedisCacheAccessPolicyAssignmentList() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Exists_RedisCacheAccessPolicyAssignmentGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_RedisCacheAccessPolicyAssignmentGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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}"); - } - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentResource.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentResource.cs deleted file mode 100644 index cb50385c8208..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyAssignmentResource.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using NUnit.Framework; - -namespace Azure.ResourceManager.Redis.Samples -{ - public partial class Sample_RedisCacheAccessPolicyAssignmentResource - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Get_RedisCacheAccessPolicyAssignmentGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Delete_RedisCacheAccessPolicyAssignmentDelete() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Update_RedisCacheAccessPolicyAssignmentCreateUpdate() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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}"); - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyCollection.cs deleted file mode 100644 index 38756975d0cb..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyCollection.cs +++ /dev/null @@ -1,199 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using NUnit.Framework; - -namespace Azure.ResourceManager.Redis.Samples -{ - public partial class Sample_RedisCacheAccessPolicyCollection - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_RedisCacheAccessPolicyCreateUpdate() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Get_RedisCacheAccessPolicyGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetAll_RedisCacheAccessPolicyList() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Exists_RedisCacheAccessPolicyGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_RedisCacheAccessPolicyGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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}"); - } - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyResource.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyResource.cs deleted file mode 100644 index ca75be9e6f69..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCacheAccessPolicyResource.cs +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using NUnit.Framework; - -namespace Azure.ResourceManager.Redis.Samples -{ - public partial class Sample_RedisCacheAccessPolicyResource - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Get_RedisCacheAccessPolicyGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Delete_RedisCacheAccessPolicyDelete() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Update_RedisCacheAccessPolicyCreateUpdate() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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}"); - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCollection.cs deleted file mode 100644 index 0dc2b284a28a..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisCollection.cs +++ /dev/null @@ -1,451 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Net; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using Azure.ResourceManager.Redis.Models; -using Azure.ResourceManager.Resources; -using NUnit.Framework; - -namespace Azure.ResourceManager.Redis.Samples -{ - public partial class Sample_RedisCollection - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_RedisCacheCreate() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this RedisResource - RedisCollection collection = resourceGroupResource.GetAllRedis(); - - // invoke the operation - string name = "cache1"; - RedisCreateOrUpdateContent content = new RedisCreateOrUpdateContent(new AzureLocation("East US"), new RedisSku(RedisSkuName.Premium, RedisSkuFamily.Premium, 1)) - { - Zones = { "1" }, - RedisConfiguration = new RedisCommonConfiguration - { - MaxMemoryPolicy = "allkeys-lru", - }, - RedisVersion = "4", - EnableNonSslPort = true, - ReplicasPerPrimary = 2, - ShardCount = 2, - MinimumTlsVersion = RedisTlsVersion.Tls1_2, - SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"), - StaticIP = IPAddress.Parse("192.168.0.5"), - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, content); - RedisResource 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 - RedisData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_RedisCacheCreateAutomaticZonalAllocationPolicy() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateAutomaticZonalAllocationPolicy.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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this RedisResource - RedisCollection collection = resourceGroupResource.GetAllRedis(); - - // invoke the operation - string name = "cache1"; - RedisCreateOrUpdateContent content = new RedisCreateOrUpdateContent(new AzureLocation("East US"), new RedisSku(RedisSkuName.Premium, RedisSkuFamily.Premium, 1)) - { - RedisConfiguration = new RedisCommonConfiguration - { - MaxMemoryPolicy = "allkeys-lru", - }, - EnableNonSslPort = true, - ReplicasPerPrimary = 2, - ShardCount = 2, - MinimumTlsVersion = RedisTlsVersion.Tls1_2, - ZonalAllocationPolicy = ZonalAllocationPolicy.Automatic, - SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"), - StaticIP = IPAddress.Parse("192.168.0.5"), - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, content); - RedisResource 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 - RedisData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_RedisCacheCreateDefaultVersion() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this RedisResource - RedisCollection collection = resourceGroupResource.GetAllRedis(); - - // invoke the operation - string name = "cache1"; - RedisCreateOrUpdateContent content = new RedisCreateOrUpdateContent(new AzureLocation("East US"), new RedisSku(RedisSkuName.Premium, RedisSkuFamily.Premium, 1)) - { - Zones = { "1" }, - RedisConfiguration = new RedisCommonConfiguration - { - MaxMemoryPolicy = "allkeys-lru", - }, - EnableNonSslPort = true, - ReplicasPerPrimary = 2, - ShardCount = 2, - MinimumTlsVersion = RedisTlsVersion.Tls1_2, - SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"), - StaticIP = IPAddress.Parse("192.168.0.5"), - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, content); - RedisResource 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 - RedisData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_RedisCacheCreateLatestVersion() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this RedisResource - RedisCollection collection = resourceGroupResource.GetAllRedis(); - - // invoke the operation - string name = "cache1"; - RedisCreateOrUpdateContent content = new RedisCreateOrUpdateContent(new AzureLocation("East US"), new RedisSku(RedisSkuName.Premium, RedisSkuFamily.Premium, 1)) - { - Zones = { "1" }, - RedisConfiguration = new RedisCommonConfiguration - { - MaxMemoryPolicy = "allkeys-lru", - }, - RedisVersion = "Latest", - EnableNonSslPort = true, - ReplicasPerPrimary = 2, - ShardCount = 2, - MinimumTlsVersion = RedisTlsVersion.Tls1_2, - SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"), - StaticIP = IPAddress.Parse("192.168.0.5"), - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, content); - RedisResource 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 - RedisData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_RedisCacheCreateNoZonesZonalAllocationPolicy() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateNoZonesZonalAllocationPolicy.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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this RedisResource - RedisCollection collection = resourceGroupResource.GetAllRedis(); - - // invoke the operation - string name = "cache1"; - RedisCreateOrUpdateContent content = new RedisCreateOrUpdateContent(new AzureLocation("East US"), new RedisSku(RedisSkuName.Premium, RedisSkuFamily.Premium, 1)) - { - RedisConfiguration = new RedisCommonConfiguration - { - MaxMemoryPolicy = "allkeys-lru", - }, - EnableNonSslPort = true, - ReplicasPerPrimary = 2, - ShardCount = 2, - MinimumTlsVersion = RedisTlsVersion.Tls1_2, - ZonalAllocationPolicy = ZonalAllocationPolicy.NoZones, - SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"), - StaticIP = IPAddress.Parse("192.168.0.5"), - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, content); - RedisResource 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 - RedisData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_RedisCacheCreateUserDefinedZonalAllocationPolicy() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheCreateUserDefinedZonalAllocationPolicy.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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this RedisResource - RedisCollection collection = resourceGroupResource.GetAllRedis(); - - // invoke the operation - string name = "cache1"; - RedisCreateOrUpdateContent content = new RedisCreateOrUpdateContent(new AzureLocation("East US"), new RedisSku(RedisSkuName.Premium, RedisSkuFamily.Premium, 1)) - { - Zones = { "1" }, - RedisConfiguration = new RedisCommonConfiguration - { - MaxMemoryPolicy = "allkeys-lru", - }, - RedisVersion = "Latest", - EnableNonSslPort = true, - ReplicasPerPrimary = 2, - ShardCount = 2, - MinimumTlsVersion = RedisTlsVersion.Tls1_2, - ZonalAllocationPolicy = ZonalAllocationPolicy.UserDefined, - SubnetId = new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg2/providers/Microsoft.Network/virtualNetworks/network1/subnets/subnet1"), - StaticIP = IPAddress.Parse("192.168.0.5"), - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, content); - RedisResource 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 - RedisData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Get_RedisCacheGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this RedisResource - RedisCollection collection = resourceGroupResource.GetAllRedis(); - - // invoke the operation - string name = "cache1"; - RedisResource result = await collection.GetAsync(name); - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - RedisData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetAll_RedisCacheListByResourceGroup() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this RedisResource - RedisCollection collection = resourceGroupResource.GetAllRedis(); - - // invoke the operation and iterate over the result - await foreach (RedisResource 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 - RedisData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Exists_RedisCacheGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this RedisResource - RedisCollection collection = resourceGroupResource.GetAllRedis(); - - // invoke the operation - string name = "cache1"; - bool result = await collection.ExistsAsync(name); - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_RedisCacheGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this ResourceGroupResource created on azure - // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); - ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); - - // get the collection of this RedisResource - RedisCollection collection = resourceGroupResource.GetAllRedis(); - - // invoke the operation - string name = "cache1"; - NullableResponse response = await collection.GetIfExistsAsync(name); - RedisResource 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 - RedisData 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/tests/Generated/Samples/Sample_RedisFirewallRuleCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisFirewallRuleCollection.cs deleted file mode 100644 index beb16f44dba3..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisFirewallRuleCollection.cs +++ /dev/null @@ -1,197 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Net; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using NUnit.Framework; - -namespace Azure.ResourceManager.Redis.Samples -{ - public partial class Sample_RedisFirewallRuleCollection - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_RedisCacheFirewallRuleCreate() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 RedisFirewallRuleResource - RedisFirewallRuleCollection collection = redis.GetRedisFirewallRules(); - - // invoke the operation - string ruleName = "rule1"; - RedisFirewallRuleData data = new RedisFirewallRuleData(IPAddress.Parse("192.168.1.1"), IPAddress.Parse("192.168.1.4")); - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, ruleName, data); - RedisFirewallRuleResource 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 - RedisFirewallRuleData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Get_RedisCacheFirewallRuleGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 RedisFirewallRuleResource - RedisFirewallRuleCollection collection = redis.GetRedisFirewallRules(); - - // invoke the operation - string ruleName = "rule1"; - RedisFirewallRuleResource result = await collection.GetAsync(ruleName); - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - RedisFirewallRuleData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetAll_RedisCacheFirewallRulesList() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 RedisFirewallRuleResource - RedisFirewallRuleCollection collection = redis.GetRedisFirewallRules(); - - // invoke the operation and iterate over the result - await foreach (RedisFirewallRuleResource 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 - RedisFirewallRuleData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Exists_RedisCacheFirewallRuleGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 RedisFirewallRuleResource - RedisFirewallRuleCollection collection = redis.GetRedisFirewallRules(); - - // invoke the operation - string ruleName = "rule1"; - bool result = await collection.ExistsAsync(ruleName); - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_RedisCacheFirewallRuleGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 RedisFirewallRuleResource - RedisFirewallRuleCollection collection = redis.GetRedisFirewallRules(); - - // invoke the operation - string ruleName = "rule1"; - NullableResponse response = await collection.GetIfExistsAsync(ruleName); - RedisFirewallRuleResource 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 - RedisFirewallRuleData 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/tests/Generated/Samples/Sample_RedisFirewallRuleResource.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisFirewallRuleResource.cs deleted file mode 100644 index e5d1902509d4..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisFirewallRuleResource.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Net; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using NUnit.Framework; - -namespace Azure.ResourceManager.Redis.Samples -{ - public partial class Sample_RedisFirewallRuleResource - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Get_RedisCacheFirewallRuleGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this RedisFirewallRuleResource created on azure - // for more information of creating RedisFirewallRuleResource, please refer to the document of RedisFirewallRuleResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - string cacheName = "cache1"; - string ruleName = "rule1"; - ResourceIdentifier redisFirewallRuleResourceId = RedisFirewallRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName, ruleName); - RedisFirewallRuleResource redisFirewallRule = client.GetRedisFirewallRuleResource(redisFirewallRuleResourceId); - - // invoke the operation - RedisFirewallRuleResource result = await redisFirewallRule.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 - RedisFirewallRuleData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Delete_RedisCacheFirewallRuleDelete() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this RedisFirewallRuleResource created on azure - // for more information of creating RedisFirewallRuleResource, please refer to the document of RedisFirewallRuleResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - string cacheName = "cache1"; - string ruleName = "rule1"; - ResourceIdentifier redisFirewallRuleResourceId = RedisFirewallRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName, ruleName); - RedisFirewallRuleResource redisFirewallRule = client.GetRedisFirewallRuleResource(redisFirewallRuleResourceId); - - // invoke the operation - await redisFirewallRule.DeleteAsync(WaitUntil.Completed); - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Update_RedisCacheFirewallRuleCreate() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this RedisFirewallRuleResource created on azure - // for more information of creating RedisFirewallRuleResource, please refer to the document of RedisFirewallRuleResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - string cacheName = "cache1"; - string ruleName = "rule1"; - ResourceIdentifier redisFirewallRuleResourceId = RedisFirewallRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName, ruleName); - RedisFirewallRuleResource redisFirewallRule = client.GetRedisFirewallRuleResource(redisFirewallRuleResourceId); - - // invoke the operation - RedisFirewallRuleData data = new RedisFirewallRuleData(IPAddress.Parse("192.168.1.1"), IPAddress.Parse("192.168.1.4")); - ArmOperation lro = await redisFirewallRule.UpdateAsync(WaitUntil.Completed, data); - RedisFirewallRuleResource 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 - RedisFirewallRuleData 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/tests/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs index 67bd945b34e5..412f641ca7c2 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_RedisLinkedServerWithPropertyCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_LinkedServerCreate() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheLinkedServer_Create.json + // Generated from example definition: 2024-11-01/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 @@ -34,14 +34,14 @@ public async Task CreateOrUpdate_LinkedServerCreate() string resourceGroupName = "rg1"; string name = "cache1"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); + RedisResource redisResource = client.GetRedisResource(redisResourceId); // get the collection of this RedisLinkedServerWithPropertyResource - RedisLinkedServerWithPropertyCollection collection = redis.GetRedisLinkedServerWithProperties(); + RedisLinkedServerWithPropertyCollection collection = redisResource.GetRedisLinkedServerWithProperties(); // invoke the operation string linkedServerName = "cache2"; - RedisLinkedServerWithPropertyCreateOrUpdateContent content = new RedisLinkedServerWithPropertyCreateOrUpdateContent(new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache2"), new AzureLocation("West US"), RedisLinkedServerRole.Secondary); + RedisLinkedServerWithPropertyCreateOrUpdateContent content = new RedisLinkedServerWithPropertyCreateOrUpdateContent(null, null, default); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, linkedServerName, content); RedisLinkedServerWithPropertyResource result = lro.Value; @@ -56,8 +56,8 @@ public async Task CreateOrUpdate_LinkedServerCreate() [Ignore("Only validating compilation of examples")] public async Task Get_LinkedServerGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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. + // Generated from example definition: 2024-11-01/RedisCacheLinkedServer_Get.json + // this example is just showing the usage of "RedisLinkedServerWithProperties_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -70,10 +70,10 @@ public async Task Get_LinkedServerGet() string resourceGroupName = "rg1"; string name = "cache1"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); + RedisResource redisResource = client.GetRedisResource(redisResourceId); // get the collection of this RedisLinkedServerWithPropertyResource - RedisLinkedServerWithPropertyCollection collection = redis.GetRedisLinkedServerWithProperties(); + RedisLinkedServerWithPropertyCollection collection = redisResource.GetRedisLinkedServerWithProperties(); // invoke the operation string linkedServerName = "cache2"; @@ -90,8 +90,8 @@ public async Task Get_LinkedServerGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_LinkedServerList() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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. + // Generated from example definition: 2024-11-01/RedisCacheLinkedServer_List.json + // this example is just showing the usage of "RedisLinkedServerWithProperties_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(); @@ -104,10 +104,10 @@ public async Task GetAll_LinkedServerList() string resourceGroupName = "rg1"; string name = "cache1"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); + RedisResource redisResource = client.GetRedisResource(redisResourceId); // get the collection of this RedisLinkedServerWithPropertyResource - RedisLinkedServerWithPropertyCollection collection = redis.GetRedisLinkedServerWithProperties(); + RedisLinkedServerWithPropertyCollection collection = redisResource.GetRedisLinkedServerWithProperties(); // invoke the operation and iterate over the result await foreach (RedisLinkedServerWithPropertyResource item in collection.GetAllAsync()) @@ -126,8 +126,8 @@ public async Task GetAll_LinkedServerList() [Ignore("Only validating compilation of examples")] public async Task Exists_LinkedServerGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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. + // Generated from example definition: 2024-11-01/RedisCacheLinkedServer_Get.json + // this example is just showing the usage of "RedisLinkedServerWithProperties_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -140,10 +140,10 @@ public async Task Exists_LinkedServerGet() string resourceGroupName = "rg1"; string name = "cache1"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); + RedisResource redisResource = client.GetRedisResource(redisResourceId); // get the collection of this RedisLinkedServerWithPropertyResource - RedisLinkedServerWithPropertyCollection collection = redis.GetRedisLinkedServerWithProperties(); + RedisLinkedServerWithPropertyCollection collection = redisResource.GetRedisLinkedServerWithProperties(); // invoke the operation string linkedServerName = "cache2"; @@ -156,8 +156,8 @@ public async Task Exists_LinkedServerGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_LinkedServerGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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. + // Generated from example definition: 2024-11-01/RedisCacheLinkedServer_Get.json + // this example is just showing the usage of "RedisLinkedServerWithProperties_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -170,10 +170,10 @@ public async Task GetIfExists_LinkedServerGet() string resourceGroupName = "rg1"; string name = "cache1"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); + RedisResource redisResource = client.GetRedisResource(redisResourceId); // get the collection of this RedisLinkedServerWithPropertyResource - RedisLinkedServerWithPropertyCollection collection = redis.GetRedisLinkedServerWithProperties(); + RedisLinkedServerWithPropertyCollection collection = redisResource.GetRedisLinkedServerWithProperties(); // invoke the operation string linkedServerName = "cache2"; diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisLinkedServerWithPropertyResource.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisLinkedServerWithPropertyResource.cs index ca8a069eff22..a7f4a4abeede 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisLinkedServerWithPropertyResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisLinkedServerWithPropertyResource.cs @@ -20,8 +20,8 @@ public partial class Sample_RedisLinkedServerWithPropertyResource [Ignore("Only validating compilation of examples")] public async Task Get_LinkedServerGet() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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. + // Generated from example definition: 2024-11-01/RedisCacheLinkedServer_Get.json + // this example is just showing the usage of "RedisLinkedServerWithProperties_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -51,8 +51,8 @@ public async Task Get_LinkedServerGet() [Ignore("Only validating compilation of examples")] public async Task Delete_LinkedServerDelete() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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. + // Generated from example definition: 2024-11-01/RedisCacheLinkedServer_Delete.json + // this example is just showing the usage of "RedisLinkedServerWithProperties_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(); @@ -78,7 +78,7 @@ public async Task Delete_LinkedServerDelete() [Ignore("Only validating compilation of examples")] public async Task Update_LinkedServerCreate() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-01/examples/RedisCacheLinkedServer_Create.json + // Generated from example definition: 2024-11-01/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 @@ -96,7 +96,7 @@ public async Task Update_LinkedServerCreate() RedisLinkedServerWithPropertyResource redisLinkedServerWithProperty = client.GetRedisLinkedServerWithPropertyResource(redisLinkedServerWithPropertyResourceId); // invoke the operation - RedisLinkedServerWithPropertyCreateOrUpdateContent content = new RedisLinkedServerWithPropertyCreateOrUpdateContent(new ResourceIdentifier("/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Cache/Redis/cache2"), new AzureLocation("West US"), RedisLinkedServerRole.Secondary); + RedisLinkedServerWithPropertyCreateOrUpdateContent content = new RedisLinkedServerWithPropertyCreateOrUpdateContent(null, null, default); ArmOperation lro = await redisLinkedServerWithProperty.UpdateAsync(WaitUntil.Completed, content); RedisLinkedServerWithPropertyResource result = lro.Value; diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPatchScheduleCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPatchScheduleCollection.cs deleted file mode 100644 index b82c091e7f76..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPatchScheduleCollection.cs +++ /dev/null @@ -1,205 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using System.Xml; -using Azure.Core; -using Azure.Identity; -using Azure.ResourceManager.Redis.Models; -using NUnit.Framework; - -namespace Azure.ResourceManager.Redis.Samples -{ - public partial class Sample_RedisPatchScheduleCollection - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_RedisCachePatchSchedulesCreateOrUpdate() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 name = "cache1"; - ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); - - // get the collection of this RedisPatchScheduleResource - RedisPatchScheduleCollection collection = redis.GetRedisPatchSchedules(); - - // invoke the operation - RedisPatchScheduleDefaultName defaultName = RedisPatchScheduleDefaultName.Default; - RedisPatchScheduleData data = new RedisPatchScheduleData(new RedisPatchScheduleSetting[] - { -new RedisPatchScheduleSetting(RedisDayOfWeek.Monday, 12) -{ -MaintenanceWindow = XmlConvert.ToTimeSpan("PT5H"), -}, -new RedisPatchScheduleSetting(RedisDayOfWeek.Tuesday, 12) - }); - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, defaultName, data); - RedisPatchScheduleResource 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 - RedisPatchScheduleData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Get_RedisCachePatchSchedulesGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 name = "cache1"; - ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); - - // get the collection of this RedisPatchScheduleResource - RedisPatchScheduleCollection collection = redis.GetRedisPatchSchedules(); - - // invoke the operation - RedisPatchScheduleDefaultName defaultName = RedisPatchScheduleDefaultName.Default; - RedisPatchScheduleResource result = await collection.GetAsync(defaultName); - - // the variable result is a resource, you could call other operations on this instance as well - // but just for demo, we get its data from this resource instance - RedisPatchScheduleData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetAll_RedisCachePatchSchedulesList() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 RedisPatchScheduleResource - RedisPatchScheduleCollection collection = redis.GetRedisPatchSchedules(); - - // invoke the operation and iterate over the result - await foreach (RedisPatchScheduleResource 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 - RedisPatchScheduleData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Exists_RedisCachePatchSchedulesGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 name = "cache1"; - ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); - - // get the collection of this RedisPatchScheduleResource - RedisPatchScheduleCollection collection = redis.GetRedisPatchSchedules(); - - // invoke the operation - RedisPatchScheduleDefaultName defaultName = RedisPatchScheduleDefaultName.Default; - bool result = await collection.ExistsAsync(defaultName); - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetIfExists_RedisCachePatchSchedulesGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 name = "cache1"; - ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); - - // get the collection of this RedisPatchScheduleResource - RedisPatchScheduleCollection collection = redis.GetRedisPatchSchedules(); - - // invoke the operation - RedisPatchScheduleDefaultName defaultName = RedisPatchScheduleDefaultName.Default; - NullableResponse response = await collection.GetIfExistsAsync(defaultName); - RedisPatchScheduleResource 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 - RedisPatchScheduleData 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/tests/Generated/Samples/Sample_RedisPatchScheduleResource.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPatchScheduleResource.cs deleted file mode 100644 index aa403ba1940d..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPatchScheduleResource.cs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using System.Xml; -using Azure.Core; -using Azure.Identity; -using Azure.ResourceManager.Redis.Models; -using NUnit.Framework; - -namespace Azure.ResourceManager.Redis.Samples -{ - public partial class Sample_RedisPatchScheduleResource - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Get_RedisCachePatchSchedulesGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this RedisPatchScheduleResource created on azure - // for more information of creating RedisPatchScheduleResource, please refer to the document of RedisPatchScheduleResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - string name = "cache1"; - RedisPatchScheduleDefaultName defaultName = RedisPatchScheduleDefaultName.Default; - ResourceIdentifier redisPatchScheduleResourceId = RedisPatchScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, defaultName); - RedisPatchScheduleResource redisPatchSchedule = client.GetRedisPatchScheduleResource(redisPatchScheduleResourceId); - - // invoke the operation - RedisPatchScheduleResource result = await redisPatchSchedule.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 - RedisPatchScheduleData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Delete_RedisCachePatchSchedulesDelete() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this RedisPatchScheduleResource created on azure - // for more information of creating RedisPatchScheduleResource, please refer to the document of RedisPatchScheduleResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - string name = "cache1"; - RedisPatchScheduleDefaultName defaultName = RedisPatchScheduleDefaultName.Default; - ResourceIdentifier redisPatchScheduleResourceId = RedisPatchScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, defaultName); - RedisPatchScheduleResource redisPatchSchedule = client.GetRedisPatchScheduleResource(redisPatchScheduleResourceId); - - // invoke the operation - await redisPatchSchedule.DeleteAsync(WaitUntil.Completed); - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Update_RedisCachePatchSchedulesCreateOrUpdate() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this RedisPatchScheduleResource created on azure - // for more information of creating RedisPatchScheduleResource, please refer to the document of RedisPatchScheduleResource - string subscriptionId = "subid"; - string resourceGroupName = "rg1"; - string name = "cache1"; - RedisPatchScheduleDefaultName defaultName = RedisPatchScheduleDefaultName.Default; - ResourceIdentifier redisPatchScheduleResourceId = RedisPatchScheduleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, defaultName); - RedisPatchScheduleResource redisPatchSchedule = client.GetRedisPatchScheduleResource(redisPatchScheduleResourceId); - - // invoke the operation - RedisPatchScheduleData data = new RedisPatchScheduleData(new RedisPatchScheduleSetting[] - { -new RedisPatchScheduleSetting(RedisDayOfWeek.Monday, 12) -{ -MaintenanceWindow = XmlConvert.ToTimeSpan("PT5H"), -}, -new RedisPatchScheduleSetting(RedisDayOfWeek.Tuesday, 12) - }); - ArmOperation lro = await redisPatchSchedule.UpdateAsync(WaitUntil.Completed, data); - RedisPatchScheduleResource 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 - RedisPatchScheduleData 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/tests/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs index 684c599d1a01..5d64f0d17858 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.Redis.Models; using NUnit.Framework; namespace Azure.ResourceManager.Redis.Samples @@ -20,8 +19,8 @@ public partial class Sample_RedisPrivateEndpointConnectionCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_RedisCachePutPrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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. + // Generated from example definition: 2024-11-01/RedisCachePutPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnection_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 TokenCredential cred = new DefaultAzureCredential(); @@ -34,21 +33,14 @@ public async Task CreateOrUpdate_RedisCachePutPrivateEndpointConnection() string resourceGroupName = "rgtest01"; string cacheName = "cachetest01"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); - RedisResource redis = client.GetRedisResource(redisResourceId); + RedisResource redisResource = client.GetRedisResource(redisResourceId); // get the collection of this RedisPrivateEndpointConnectionResource - RedisPrivateEndpointConnectionCollection collection = redis.GetRedisPrivateEndpointConnections(); + RedisPrivateEndpointConnectionCollection collection = redisResource.GetRedisPrivateEndpointConnections(); // invoke the operation string privateEndpointConnectionName = "pectest01"; - RedisPrivateEndpointConnectionData data = new RedisPrivateEndpointConnectionData - { - RedisPrivateLinkServiceConnectionState = new RedisPrivateLinkServiceConnectionState - { - Status = RedisPrivateEndpointServiceConnectionStatus.Approved, - Description = "Auto-Approved", - }, - }; + RedisPrivateEndpointConnectionData data = new RedisPrivateEndpointConnectionData(); ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); RedisPrivateEndpointConnectionResource result = lro.Value; @@ -63,8 +55,8 @@ public async Task CreateOrUpdate_RedisCachePutPrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task Get_RedisCacheGetPrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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. + // Generated from example definition: 2024-11-01/RedisCacheGetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnection_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -77,10 +69,10 @@ public async Task Get_RedisCacheGetPrivateEndpointConnection() string resourceGroupName = "rgtest01"; string cacheName = "cachetest01"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); - RedisResource redis = client.GetRedisResource(redisResourceId); + RedisResource redisResource = client.GetRedisResource(redisResourceId); // get the collection of this RedisPrivateEndpointConnectionResource - RedisPrivateEndpointConnectionCollection collection = redis.GetRedisPrivateEndpointConnections(); + RedisPrivateEndpointConnectionCollection collection = redisResource.GetRedisPrivateEndpointConnections(); // invoke the operation string privateEndpointConnectionName = "pectest01"; @@ -97,8 +89,8 @@ public async Task Get_RedisCacheGetPrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task GetAll_RedisCacheListPrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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. + // Generated from example definition: 2024-11-01/RedisCacheListPrivateEndpointConnections.json + // this example is just showing the usage of "PrivateEndpointConnection_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(); @@ -111,10 +103,10 @@ public async Task GetAll_RedisCacheListPrivateEndpointConnection() string resourceGroupName = "rgtest01"; string cacheName = "cachetest01"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); - RedisResource redis = client.GetRedisResource(redisResourceId); + RedisResource redisResource = client.GetRedisResource(redisResourceId); // get the collection of this RedisPrivateEndpointConnectionResource - RedisPrivateEndpointConnectionCollection collection = redis.GetRedisPrivateEndpointConnections(); + RedisPrivateEndpointConnectionCollection collection = redisResource.GetRedisPrivateEndpointConnections(); // invoke the operation and iterate over the result await foreach (RedisPrivateEndpointConnectionResource item in collection.GetAllAsync()) @@ -133,8 +125,8 @@ public async Task GetAll_RedisCacheListPrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task Exists_RedisCacheGetPrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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. + // Generated from example definition: 2024-11-01/RedisCacheGetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnection_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -147,10 +139,10 @@ public async Task Exists_RedisCacheGetPrivateEndpointConnection() string resourceGroupName = "rgtest01"; string cacheName = "cachetest01"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); - RedisResource redis = client.GetRedisResource(redisResourceId); + RedisResource redisResource = client.GetRedisResource(redisResourceId); // get the collection of this RedisPrivateEndpointConnectionResource - RedisPrivateEndpointConnectionCollection collection = redis.GetRedisPrivateEndpointConnections(); + RedisPrivateEndpointConnectionCollection collection = redisResource.GetRedisPrivateEndpointConnections(); // invoke the operation string privateEndpointConnectionName = "pectest01"; @@ -163,8 +155,8 @@ public async Task Exists_RedisCacheGetPrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_RedisCacheGetPrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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. + // Generated from example definition: 2024-11-01/RedisCacheGetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnection_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -177,10 +169,10 @@ public async Task GetIfExists_RedisCacheGetPrivateEndpointConnection() string resourceGroupName = "rgtest01"; string cacheName = "cachetest01"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); - RedisResource redis = client.GetRedisResource(redisResourceId); + RedisResource redisResource = client.GetRedisResource(redisResourceId); // get the collection of this RedisPrivateEndpointConnectionResource - RedisPrivateEndpointConnectionCollection collection = redis.GetRedisPrivateEndpointConnections(); + RedisPrivateEndpointConnectionCollection collection = redisResource.GetRedisPrivateEndpointConnections(); // invoke the operation string privateEndpointConnectionName = "pectest01"; diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPrivateEndpointConnectionResource.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPrivateEndpointConnectionResource.cs index fc202ebd3845..8381f9fb0949 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPrivateEndpointConnectionResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPrivateEndpointConnectionResource.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.Redis.Models; using NUnit.Framework; namespace Azure.ResourceManager.Redis.Samples @@ -20,8 +19,8 @@ public partial class Sample_RedisPrivateEndpointConnectionResource [Ignore("Only validating compilation of examples")] public async Task Get_RedisCacheGetPrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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. + // Generated from example definition: 2024-11-01/RedisCacheGetPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnection_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line TokenCredential cred = new DefaultAzureCredential(); @@ -51,8 +50,8 @@ public async Task Get_RedisCacheGetPrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task Delete_RedisCacheDeletePrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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. + // Generated from example definition: 2024-11-01/RedisCacheDeletePrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnection_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(); @@ -78,8 +77,8 @@ public async Task Delete_RedisCacheDeletePrivateEndpointConnection() [Ignore("Only validating compilation of examples")] public async Task Update_RedisCachePutPrivateEndpointConnection() { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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. + // Generated from example definition: 2024-11-01/RedisCachePutPrivateEndpointConnection.json + // this example is just showing the usage of "PrivateEndpointConnection_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 TokenCredential cred = new DefaultAzureCredential(); @@ -96,14 +95,7 @@ public async Task Update_RedisCachePutPrivateEndpointConnection() RedisPrivateEndpointConnectionResource redisPrivateEndpointConnection = client.GetRedisPrivateEndpointConnectionResource(redisPrivateEndpointConnectionResourceId); // invoke the operation - RedisPrivateEndpointConnectionData data = new RedisPrivateEndpointConnectionData - { - RedisPrivateLinkServiceConnectionState = new RedisPrivateLinkServiceConnectionState - { - Status = RedisPrivateEndpointServiceConnectionStatus.Approved, - Description = "Auto-Approved", - }, - }; + RedisPrivateEndpointConnectionData data = new RedisPrivateEndpointConnectionData(); ArmOperation lro = await redisPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); RedisPrivateEndpointConnectionResource result = lro.Value; diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisResource.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisResource.cs deleted file mode 100644 index 92bfbfa04f46..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisResource.cs +++ /dev/null @@ -1,345 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using Azure.ResourceManager.Models; -using Azure.ResourceManager.Redis.Models; -using NUnit.Framework; - -namespace Azure.ResourceManager.Redis.Samples -{ - public partial class Sample_RedisResource - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Get_RedisCacheGet() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 name = "cache1"; - ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); - - // invoke the operation - RedisResource result = await redis.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 - RedisData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Delete_RedisCacheDelete() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 name = "cache1"; - ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); - - // invoke the operation - await redis.DeleteAsync(WaitUntil.Completed); - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Update_RedisCacheUpdate() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 name = "cache1"; - ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); - - // invoke the operation - RedisPatch patch = new RedisPatch - { - EnableNonSslPort = true, - ReplicasPerPrimary = 2, - }; - ArmOperation lro = await redis.UpdateAsync(WaitUntil.Completed, patch); - RedisResource 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 - RedisData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetUpgradeNotifications_RedisCacheListUpgradeNotifications() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 name = "cache1"; - ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); - - // invoke the operation and iterate over the result - double history = 5000; - await foreach (RedisUpgradeNotification item in redis.GetUpgradeNotificationsAsync(history)) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetKeys_RedisCacheListKeys() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 name = "cache1"; - ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); - - // invoke the operation - RedisAccessKeys result = await redis.GetKeysAsync(); - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task RegenerateKey_RedisCacheRegenerateKey() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 name = "cache1"; - ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); - - // invoke the operation - RedisRegenerateKeyContent content = new RedisRegenerateKeyContent(RedisRegenerateKeyType.Primary); - RedisAccessKeys result = await redis.RegenerateKeyAsync(content); - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task ForceReboot_RedisCacheForceReboot() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 name = "cache1"; - ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); - - // invoke the operation - RedisRebootContent content = new RedisRebootContent - { - RebootType = RedisRebootType.AllNodes, - ShardId = 0, - Ports = { 13000, 15001 }, - }; - RedisForceRebootResult result = await redis.ForceRebootAsync(content); - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task ImportData_RedisCacheImport() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 name = "cache1"; - ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); - - // invoke the operation - ImportRdbContent content = new ImportRdbContent(new string[] { "http://fileuris.contoso.com/pathtofile1" }) - { - Format = "RDB", - StorageSubscriptionId = "storageSubId", - }; - await redis.ImportDataAsync(WaitUntil.Completed, content); - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task ExportData_RedisCacheExport() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 name = "cache1"; - ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redis = client.GetRedisResource(redisResourceId); - - // invoke the operation - ExportRdbContent content = new ExportRdbContent("datadump1", "https://contosostorage.blob.core.window.net/urltoBlobContainer?sasKeyParameters") - { - Format = "RDB", - StorageSubscriptionId = "storageSubId", - }; - await redis.ExportDataAsync(WaitUntil.Completed, content); - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task FlushCache_RedisCacheFlush() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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}"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetPrivateLinkResourcesByRedisCache_StorageAccountListPrivateLinkResources() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - 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 = "{subscription-id}"; - string resourceGroupName = "rgtest01"; - string cacheName = "cacheTest01"; - ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); - RedisResource redis = client.GetRedisResource(redisResourceId); - - // invoke the operation and iterate over the result - await foreach (RedisPrivateLinkResource item in redis.GetPrivateLinkResourcesByRedisCacheAsync()) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine("Succeeded"); - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs deleted file mode 100644 index e950416c04fe..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using Azure.ResourceManager.Redis.Models; -using Azure.ResourceManager.Resources; -using NUnit.Framework; - -namespace Azure.ResourceManager.Redis.Samples -{ - public partial class Sample_SubscriptionResourceExtensions - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task CheckRedisNameAvailability_RedisCacheCheckNameAvailability() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this SubscriptionResource created on azure - // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "subid"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); - - // invoke the operation - RedisNameAvailabilityContent content = new RedisNameAvailabilityContent("cacheName", new ResourceType("Microsoft.Cache/Redis")); - await subscriptionResource.CheckRedisNameAvailabilityAsync(content); - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetAllRedis_RedisCacheList() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this SubscriptionResource created on azure - // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "subid"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); - - // invoke the operation and iterate over the result - await foreach (RedisResource item in subscriptionResource.GetAllRedisAsync()) - { - // 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 - RedisData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine("Succeeded"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetAsyncOperationStatus_RedisCacheAsyncOperationStatus() - { - // Generated from example definition: specification/redis/resource-manager/Microsoft.Cache/stable/2024-11-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 - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this SubscriptionResource created on azure - // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "subid"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); - - // invoke the operation - AzureLocation location = new AzureLocation("East US"); - string operationId = "c7ba2bf5-5939-4d79-b037-2964ccf097da"; - RedisOperationStatus result = await subscriptionResource.GetAsyncOperationStatusAsync(location, operationId); - - Console.WriteLine($"Succeeded: {result}"); - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_TenantResourceExtensions.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_TenantResourceExtensions.cs new file mode 100644 index 000000000000..02c84c0a6c15 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_TenantResourceExtensions.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Redis.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Redis.Samples +{ + public partial class Sample_TenantResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task List_RedisCacheOperations() + { + // Generated from example definition: 2024-11-01/RedisCacheOperations.json + // this example is just showing the usage of "Operations_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); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation and iterate over the result + await foreach (Models.Operation item in tenantResource.ListAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/tsp-location.yaml b/sdk/redis/Azure.ResourceManager.Redis/tsp-location.yaml new file mode 100644 index 000000000000..0cbf25c4778e --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/tsp-location.yaml @@ -0,0 +1,3 @@ +directory: specification/redis/Cache.Management +commit: 89fd8c33eae90dad136c55a67491586db1445f41 +repo: Azure/azure-rest-api-specs \ No newline at end of file From 07d8bbaa17f5f84fe0d6c6ab6d2c6f4c2bb91c5d Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Wed, 27 Aug 2025 09:34:07 +0800 Subject: [PATCH 2/4] regen --- .../src/Customization/Models/RedisPatch.cs | 12 + .../Customization/Models/RedisTlsVersion.cs | 6 +- .../src/Customization/RedisResource.cs | 12 +- .../src/Generated/ArmRedisModelFactory.cs | 91 +++-- .../MockableRedisSubscriptionResource.cs | 8 +- .../Generated/Extensions/RedisExtensions.cs | 12 +- .../AzureResourceManagerRedisContext.cs | 15 +- .../Models/DayOfWeek.Serialization.cs | 42 --- .../src/Generated/Models/DefaultName.cs | 48 --- .../RedisCommonConfiguration.Serialization.cs | 341 ++++++++++++++++++ .../Models/RedisCommonConfiguration.cs | 137 +++++++ .../Models/RedisDayOfWeek.Serialization.cs | 42 +++ .../{DayOfWeek.cs => RedisDayOfWeek.cs} | 2 +- ...> RedisForceRebootResult.Serialization.cs} | 38 +- ...tResponse.cs => RedisForceRebootResult.cs} | 10 +- .../Models/RedisKeyType.Serialization.cs | 28 -- .../RedisLinkedServerRole.Serialization.cs | 28 ++ ...cationRole.cs => RedisLinkedServerRole.cs} | 2 +- ...ertyCreateOrUpdateContent.Serialization.cs | 4 +- ...ServerWithPropertyCreateOrUpdateContent.cs | 6 +- ...sNameAvailabilityContent.Serialization.cs} | 38 +- ...ent.cs => RedisNameAvailabilityContent.cs} | 14 +- ... => RedisOperationStatus.Serialization.cs} | 38 +- ...ationStatus.cs => RedisOperationStatus.cs} | 14 +- ...ization.cs => RedisPatch.Serialization.cs} | 38 +- .../{RedisResourcePatch.cs => RedisPatch.cs} | 10 +- .../Models/RedisPatchScheduleDefaultName.cs | 48 +++ ...edisPatchScheduleSetting.Serialization.cs} | 42 +-- ...eEntry.cs => RedisPatchScheduleSetting.cs} | 16 +- ...ningState.cs => RedisProvisioningState.cs} | 48 +-- .../RedisRebootContent.Serialization.cs | 4 +- .../Generated/Models/RedisRebootContent.cs | 4 +- .../{RebootType.cs => RedisRebootType.cs} | 28 +- ...RedisRegenerateKeyContent.Serialization.cs | 4 +- .../Models/RedisRegenerateKeyContent.cs | 6 +- .../RedisRegenerateKeyType.Serialization.cs | 28 ++ ...isKeyType.cs => RedisRegenerateKeyType.cs} | 2 +- .../src/Generated/Models/RedisSkuFamily.cs | 8 +- .../src/Generated/Models/RedisTlsVersion.cs | 54 +++ ...RedisUpgradeNotification.Serialization.cs} | 38 +- ...ication.cs => RedisUpgradeNotification.cs} | 10 +- ...NotificationListResponse.Serialization.cs} | 44 +-- ...> RedisUpgradeNotificationListResponse.cs} | 16 +- .../Models/ReplicationRole.Serialization.cs | 28 -- ...ccessPolicyAssignmentData.Serialization.cs | 10 +- .../RedisCacheAccessPolicyAssignmentData.cs | 4 +- .../Generated/RedisPatchScheduleCollection.cs | 16 +- .../RedisPatchScheduleData.Serialization.cs | 6 +- .../src/Generated/RedisPatchScheduleData.cs | 6 +- .../Generated/RedisPatchScheduleResource.cs | 2 +- ...ateEndpointConnectionData.Serialization.cs | 8 +- .../RedisPrivateEndpointConnectionData.cs | 14 +- .../src/Generated/RedisResource.cs | 36 +- .../RedisResourceData.Serialization.cs | 4 +- .../src/Generated/RedisResourceData.cs | 4 +- ...ationStatusOperationGroupRestOperations.cs | 12 +- .../RedisOperationGroupRestOperations.cs | 8 +- .../RedisPatchSchedulesRestOperations.cs | 24 +- .../RedisResourcesRestOperations.cs | 44 +-- .../tsp-location.yaml | 2 +- 60 files changed, 1131 insertions(+), 533 deletions(-) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisPatch.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DayOfWeek.Serialization.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DefaultName.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisDayOfWeek.Serialization.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{DayOfWeek.cs => RedisDayOfWeek.cs} (96%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisForceRebootResponse.Serialization.cs => RedisForceRebootResult.Serialization.cs} (66%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisForceRebootResponse.cs => RedisForceRebootResult.cs} (88%) delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisKeyType.Serialization.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerRole.Serialization.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{ReplicationRole.cs => RedisLinkedServerRole.cs} (92%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{CheckNameAvailabilityContent.Serialization.cs => RedisNameAvailabilityContent.Serialization.cs} (75%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{CheckNameAvailabilityContent.cs => RedisNameAvailabilityContent.cs} (84%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{OperationStatus.Serialization.cs => RedisOperationStatus.Serialization.cs} (80%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{OperationStatus.cs => RedisOperationStatus.cs} (75%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisResourcePatch.Serialization.cs => RedisPatch.Serialization.cs} (78%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisResourcePatch.cs => RedisPatch.cs} (89%) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleDefaultName.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{ScheduleEntry.Serialization.cs => RedisPatchScheduleSetting.Serialization.cs} (67%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{ScheduleEntry.cs => RedisPatchScheduleSetting.cs} (80%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{ProvisioningState.cs => RedisProvisioningState.cs} (53%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RebootType.cs => RedisRebootType.cs} (56%) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyType.Serialization.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisKeyType.cs => RedisRegenerateKeyType.cs} (91%) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisTlsVersion.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{UpgradeNotification.Serialization.cs => RedisUpgradeNotification.Serialization.cs} (72%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{UpgradeNotification.cs => RedisUpgradeNotification.cs} (84%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{NotificationListResponse.Serialization.cs => RedisUpgradeNotificationListResponse.Serialization.cs} (63%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{NotificationListResponse.cs => RedisUpgradeNotificationListResponse.cs} (76%) delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ReplicationRole.Serialization.cs diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisPatch.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisPatch.cs new file mode 100644 index 000000000000..fd682c90d5bc --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisPatch.cs @@ -0,0 +1,12 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; + +namespace Azure.ResourceManager.Redis.Models +{ + [CodeGenType("RedisResourcePatch")] + public partial class RedisPatch + { + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisTlsVersion.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisTlsVersion.cs index 6460d6c11f7b..757461e094cb 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisTlsVersion.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisTlsVersion.cs @@ -21,19 +21,19 @@ namespace Azure.ResourceManager.Redis.Models /// Serialized Name: TlsVersion.1.0 /// [CodeGenMember("One0")] - public static RedisTlsVersion Tls1_0 { get; } = new RedisTlsVersion(Tls1_0Value); + public static RedisTlsVersion Tls1_0 { get; } = new RedisTlsVersion(_10Value); /// /// 1.1 /// Serialized Name: TlsVersion.1.1 /// [CodeGenMember("One1")] - public static RedisTlsVersion Tls1_1 { get; } = new RedisTlsVersion(Tls1_1Value); + public static RedisTlsVersion Tls1_1 { get; } = new RedisTlsVersion(_11Value); /// /// 1.2 /// Serialized Name: TlsVersion.1.2 /// [CodeGenMember("One2")] - public static RedisTlsVersion Tls1_2 { get; } = new RedisTlsVersion(Tls1_2Value); + public static RedisTlsVersion Tls1_2 { get; } = new RedisTlsVersion(_12Value); #pragma warning restore CA1707 } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Customization/RedisResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Customization/RedisResource.cs index 2550216261b8..7278a92629e8 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Customization/RedisResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Customization/RedisResource.cs @@ -48,12 +48,12 @@ public virtual async Task> UpdateAsync(RedisPatch patch, { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.Update"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Update"); scope.Start(); try { - var response = await _redisRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new RedisArmOperation(new RedisOperationSource(Client), _redisClientDiagnostics, Pipeline, _redisRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = await _redisResourceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new RedisResourceOperationSource(Client), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); return await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } catch (Exception e) @@ -85,12 +85,12 @@ public virtual Response Update(RedisPatch patch, CancellationToke { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _redisClientDiagnostics.CreateScope("RedisResource.Update"); + using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Update"); scope.Start(); try { - var response = _redisRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - var operation = new RedisArmOperation(new RedisOperationSource(Client), _redisClientDiagnostics, Pipeline, _redisRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = _redisResourceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new RedisArmOperation(new RedisResourceOperationSource(Client), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); return operation.WaitForCompletion(cancellationToken); } catch (Exception e) diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs index 709df64fed34..4f6b1c69bf8e 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs @@ -72,10 +72,10 @@ public static RedisInstanceDetails RedisInstanceDetails(int? sslPort = null, int /// The resourceType. /// The systemData. /// The private endpoint resource. - /// A collection of information about the state of the connection between service consumer and provider. - /// The provisioning state of the private endpoint connection resource. + /// A collection of information about the state of the connection between service consumer and provider. + /// The provisioning state of the private endpoint connection resource. /// A new instance for mocking. - public static RedisPrivateEndpointConnectionData RedisPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier privateEndpointId = null, RedisPrivateLinkServiceConnectionState privateLinkServiceConnectionState = null, RedisPrivateEndpointConnectionProvisioningState? provisioningState = null) + public static RedisPrivateEndpointConnectionData RedisPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier privateEndpointId = null, RedisPrivateLinkServiceConnectionState redisPrivateLinkServiceConnectionState = null, RedisPrivateEndpointConnectionProvisioningState? redisProvisioningState = null) { return new RedisPrivateEndpointConnectionData( id, @@ -83,11 +83,60 @@ public static RedisPrivateEndpointConnectionData RedisPrivateEndpointConnectionD resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, - privateLinkServiceConnectionState, - provisioningState, + redisPrivateLinkServiceConnectionState, + redisProvisioningState, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// 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. + /// The keyspace events which should be monitored. + /// 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; you should never disable authentication using this property!. + /// 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 notifyKeyspaceEvents = 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, + notifyKeyspaceEvents, + preferredDataArchiveAuthMethod, + preferredDataPersistenceAuthMethod, + zonalConfiguration, + authnotrequired, + storageSubscriptionId, + isAadEnabled, + additionalProperties); + } + /// Initializes a new instance of . /// 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. @@ -113,24 +162,24 @@ public static RedisResourceCreateOrUpdateContent RedisResourceCreateOrUpdateCont serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Name of upgrade notification. /// Timestamp when upgrade notification occurred. /// Details about this upgrade notification. - /// A new instance for mocking. - public static UpgradeNotification UpgradeNotification(string name = null, DateTimeOffset? timestamp = null, IReadOnlyDictionary upsellNotification = null) + /// A new instance for mocking. + public static RedisUpgradeNotification RedisUpgradeNotification(string name = null, DateTimeOffset? timestamp = null, IReadOnlyDictionary upsellNotification = null) { upsellNotification ??= new Dictionary(); - return new UpgradeNotification(name, timestamp, upsellNotification, serializedAdditionalRawData: null); + return new RedisUpgradeNotification(name, timestamp, upsellNotification, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Status message. - /// A new instance for mocking. - public static RedisForceRebootResponse RedisForceRebootResponse(string message = null) + /// A new instance for mocking. + public static RedisForceRebootResult RedisForceRebootResult(string message = null) { - return new RedisForceRebootResponse(message, serializedAdditionalRawData: null); + return new RedisForceRebootResult(message, serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -236,9 +285,9 @@ public static RedisFirewallRuleData RedisFirewallRuleData(ResourceIdentifier id /// List of patch schedules for a Redis cache. /// The geo-location where the resource lives. /// A new instance for mocking. - public static RedisPatchScheduleData RedisPatchScheduleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable scheduleEntries = null, string location = null) + public static RedisPatchScheduleData RedisPatchScheduleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable scheduleEntries = null, string location = null) { - scheduleEntries ??= new List(); + scheduleEntries ??= new List(); return new RedisPatchScheduleData( id, @@ -275,7 +324,7 @@ public static RedisLinkedServerWithPropertyData RedisLinkedServerWithPropertyDat /// The unchanging DNS name which will always point to current geo-primary cache among the linked redis caches for seamless Geo Failover experience. /// The changing DNS name that resolves to the current geo-primary cache among the linked redis caches before or after the Geo Failover. /// A new instance for mocking. - public static RedisLinkedServerWithPropertyCreateOrUpdateContent RedisLinkedServerWithPropertyCreateOrUpdateContent(string linkedRedisCacheId = null, string linkedRedisCacheLocation = null, ReplicationRole serverRole = default, string geoReplicatedPrimaryHostName = null, string primaryHostName = null) + public static RedisLinkedServerWithPropertyCreateOrUpdateContent RedisLinkedServerWithPropertyCreateOrUpdateContent(string linkedRedisCacheId = null, string linkedRedisCacheLocation = null, RedisLinkedServerRole serverRole = default, string geoReplicatedPrimaryHostName = null, string primaryHostName = null) { return new RedisLinkedServerWithPropertyCreateOrUpdateContent( linkedRedisCacheId, @@ -318,7 +367,7 @@ public static RedisCacheAccessPolicyData RedisCacheAccessPolicyData(ResourceIden /// 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, string objectId = null, string objectIdAlias = null, string accessPolicyName = null) + 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, @@ -332,7 +381,7 @@ public static RedisCacheAccessPolicyAssignmentData RedisCacheAccessPolicyAssignm serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Fully qualified ID for the async operation. /// Name of the async operation. /// Operation status. @@ -342,13 +391,13 @@ public static RedisCacheAccessPolicyAssignmentData RedisCacheAccessPolicyAssignm /// The operations list. /// If present, details of the operation error. /// Additional properties from RP, only when operation is successful. - /// A new instance for mocking. - public static OperationStatus OperationStatus(string id = null, string name = null, string status = null, double? percentComplete = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, IEnumerable operations = null, ResponseError error = null, IReadOnlyDictionary properties = null) + /// A new instance for mocking. + public static RedisOperationStatus RedisOperationStatus(string id = null, string name = null, string status = null, double? percentComplete = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, IEnumerable operations = null, ResponseError error = null, IReadOnlyDictionary properties = null) { operations ??= new List(); properties ??= new Dictionary(); - return new OperationStatus( + return new RedisOperationStatus( id, name, status, diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisSubscriptionResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisSubscriptionResource.cs index 2b1274970bf3..a7d1d78a9c3d 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisSubscriptionResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisSubscriptionResource.cs @@ -130,7 +130,7 @@ public virtual Pageable ListBySubscription(CancellationToken canc /// The request body. /// The cancellation token to use. /// is null. - public virtual async Task CheckNameAvailabilityAsync(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + public virtual async Task CheckNameAvailabilityAsync(RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); @@ -168,7 +168,7 @@ public virtual async Task CheckNameAvailabilityAsync(CheckNameAvailabi /// The request body. /// The cancellation token to use. /// is null. - public virtual Response CheckNameAvailability(CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + public virtual Response CheckNameAvailability(RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); @@ -208,7 +208,7 @@ public virtual Response CheckNameAvailability(CheckNameAvailabilityContent conte /// The cancellation token to use. /// or is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> GetAsync(string location, string operationId, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(string location, string operationId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(location, nameof(location)); Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); @@ -249,7 +249,7 @@ public virtual async Task> GetAsync(string location, s /// The cancellation token to use. /// or is an empty string, and was expected to be non-empty. /// or is null. - public virtual Response Get(string location, string operationId, CancellationToken cancellationToken = default) + public virtual Response Get(string location, string operationId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(location, nameof(location)); Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); 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 093e7f27feda..009102e099e7 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/RedisExtensions.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/RedisExtensions.cs @@ -354,14 +354,14 @@ public static Pageable ListBySubscription(this SubscriptionResour /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The request body. /// The cancellation token to use. /// or is null. - public static async Task CheckNameAvailabilityAsync(this SubscriptionResource subscriptionResource, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + public static async Task CheckNameAvailabilityAsync(this SubscriptionResource subscriptionResource, RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); @@ -386,14 +386,14 @@ public static async Task CheckNameAvailabilityAsync(this SubscriptionR /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The request body. /// The cancellation token to use. /// or is null. - public static Response CheckNameAvailability(this SubscriptionResource subscriptionResource, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + public static Response CheckNameAvailability(this SubscriptionResource subscriptionResource, RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); @@ -427,7 +427,7 @@ public static Response CheckNameAvailability(this SubscriptionResource subscript /// The cancellation token to use. /// or is an empty string, and was expected to be non-empty. /// , or is null. - public static async Task> GetAsync(this SubscriptionResource subscriptionResource, string location, string operationId, CancellationToken cancellationToken = default) + public static async Task> GetAsync(this SubscriptionResource subscriptionResource, string location, string operationId, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); @@ -461,7 +461,7 @@ public static async Task> GetAsync(this SubscriptionRe /// The cancellation token to use. /// or is an empty string, and was expected to be non-empty. /// , or is null. - public static Response Get(this SubscriptionResource subscriptionResource, string location, string operationId, CancellationToken cancellationToken = default) + public static Response Get(this SubscriptionResource subscriptionResource, string location, string operationId, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AzureResourceManagerRedisContext.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AzureResourceManagerRedisContext.cs index ff3566b30868..ae4f40fba3e9 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AzureResourceManagerRedisContext.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AzureResourceManagerRedisContext.cs @@ -16,15 +16,12 @@ namespace Azure.ResourceManager.Redis /// Context class which will be filled in by the System.ClientModel.SourceGeneration. /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' /// - [ModelReaderWriterBuildable(typeof(CheckNameAvailabilityContent))] [ModelReaderWriterBuildable(typeof(ExportRDBContent))] [ModelReaderWriterBuildable(typeof(ImportRDBContent))] [ModelReaderWriterBuildable(typeof(ManagedServiceIdentity))] - [ModelReaderWriterBuildable(typeof(NotificationListResponse))] [ModelReaderWriterBuildable(typeof(Models.Operation))] [ModelReaderWriterBuildable(typeof(OperationDisplay))] [ModelReaderWriterBuildable(typeof(OperationListResult))] - [ModelReaderWriterBuildable(typeof(OperationStatus))] [ModelReaderWriterBuildable(typeof(Models.OperationStatusResult))] [ModelReaderWriterBuildable(typeof(RedisAccessKeys))] [ModelReaderWriterBuildable(typeof(RedisCacheAccessPolicyAssignmentData))] @@ -33,19 +30,24 @@ namespace Azure.ResourceManager.Redis [ModelReaderWriterBuildable(typeof(RedisCacheAccessPolicyData))] [ModelReaderWriterBuildable(typeof(RedisCacheAccessPolicyList))] [ModelReaderWriterBuildable(typeof(RedisCacheAccessPolicyResource))] + [ModelReaderWriterBuildable(typeof(RedisCommonConfiguration))] [ModelReaderWriterBuildable(typeof(RedisFirewallRuleData))] [ModelReaderWriterBuildable(typeof(RedisFirewallRuleListResult))] [ModelReaderWriterBuildable(typeof(RedisFirewallRuleResource))] - [ModelReaderWriterBuildable(typeof(RedisForceRebootResponse))] + [ModelReaderWriterBuildable(typeof(RedisForceRebootResult))] [ModelReaderWriterBuildable(typeof(RedisInstanceDetails))] [ModelReaderWriterBuildable(typeof(RedisLinkedServerWithPropertiesList))] [ModelReaderWriterBuildable(typeof(RedisLinkedServerWithPropertyCreateOrUpdateContent))] [ModelReaderWriterBuildable(typeof(RedisLinkedServerWithPropertyData))] [ModelReaderWriterBuildable(typeof(RedisLinkedServerWithPropertyResource))] [ModelReaderWriterBuildable(typeof(RedisListResult))] + [ModelReaderWriterBuildable(typeof(RedisNameAvailabilityContent))] + [ModelReaderWriterBuildable(typeof(RedisOperationStatus))] + [ModelReaderWriterBuildable(typeof(RedisPatch))] [ModelReaderWriterBuildable(typeof(RedisPatchScheduleData))] [ModelReaderWriterBuildable(typeof(RedisPatchScheduleListResult))] [ModelReaderWriterBuildable(typeof(RedisPatchScheduleResource))] + [ModelReaderWriterBuildable(typeof(RedisPatchScheduleSetting))] [ModelReaderWriterBuildable(typeof(RedisPrivateEndpointConnectionData))] [ModelReaderWriterBuildable(typeof(RedisPrivateEndpointConnectionListResult))] [ModelReaderWriterBuildable(typeof(RedisPrivateEndpointConnectionResource))] @@ -58,13 +60,12 @@ namespace Azure.ResourceManager.Redis [ModelReaderWriterBuildable(typeof(RedisResource))] [ModelReaderWriterBuildable(typeof(RedisResourceCreateOrUpdateContent))] [ModelReaderWriterBuildable(typeof(RedisResourceData))] - [ModelReaderWriterBuildable(typeof(RedisResourcePatch))] [ModelReaderWriterBuildable(typeof(RedisSku))] + [ModelReaderWriterBuildable(typeof(RedisUpgradeNotification))] + [ModelReaderWriterBuildable(typeof(RedisUpgradeNotificationListResponse))] [ModelReaderWriterBuildable(typeof(ResponseError))] - [ModelReaderWriterBuildable(typeof(ScheduleEntry))] [ModelReaderWriterBuildable(typeof(SubResource))] [ModelReaderWriterBuildable(typeof(SystemData))] - [ModelReaderWriterBuildable(typeof(UpgradeNotification))] [ModelReaderWriterBuildable(typeof(UserAssignedIdentity))] public partial class AzureResourceManagerRedisContext : ModelReaderWriterContext { diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DayOfWeek.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DayOfWeek.Serialization.cs deleted file mode 100644 index 322746124ec7..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DayOfWeek.Serialization.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Redis.Models -{ - internal static partial class DayOfWeekExtensions - { - public static string ToSerialString(this DayOfWeek value) => value switch - { - DayOfWeek.Monday => "Monday", - DayOfWeek.Tuesday => "Tuesday", - DayOfWeek.Wednesday => "Wednesday", - DayOfWeek.Thursday => "Thursday", - DayOfWeek.Friday => "Friday", - DayOfWeek.Saturday => "Saturday", - DayOfWeek.Sunday => "Sunday", - DayOfWeek.Everyday => "Everyday", - DayOfWeek.Weekend => "Weekend", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DayOfWeek value.") - }; - - public static DayOfWeek ToDayOfWeek(this string value) - { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Monday")) return DayOfWeek.Monday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Tuesday")) return DayOfWeek.Tuesday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Wednesday")) return DayOfWeek.Wednesday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Thursday")) return DayOfWeek.Thursday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Friday")) return DayOfWeek.Friday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Saturday")) return DayOfWeek.Saturday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Sunday")) return DayOfWeek.Sunday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Everyday")) return DayOfWeek.Everyday; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Weekend")) return DayOfWeek.Weekend; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DayOfWeek value."); - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DefaultName.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DefaultName.cs deleted file mode 100644 index f58acf3ce37c..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DefaultName.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.Redis.Models -{ - /// The name of the resource that is the target of a particular operation. For singleton resources, it must be 'Default'. - public readonly partial struct DefaultName : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public DefaultName(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string DefaultValue = "default"; - - /// The name of e.g. the patch schedules resource, which is a singleton, must always be 'Default' *. - public static DefaultName Default { get; } = new DefaultName(DefaultValue); - /// Determines if two values are the same. - public static bool operator ==(DefaultName left, DefaultName right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(DefaultName left, DefaultName right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator DefaultName(string value) => new DefaultName(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is DefaultName other && Equals(other); - /// - public bool Equals(DefaultName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.Serialization.cs new file mode 100644 index 000000000000..3f4390b9a4b4 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.Serialization.cs @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Redis.Models +{ + public partial class RedisCommonConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RedisCommonConfiguration)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(IsRdbBackupEnabled)) + { + writer.WritePropertyName("rdb-backup-enabled"u8); + writer.WriteBooleanValue(IsRdbBackupEnabled.Value); + } + if (Optional.IsDefined(RdbBackupFrequency)) + { + writer.WritePropertyName("rdb-backup-frequency"u8); + writer.WriteStringValue(RdbBackupFrequency); + } + if (Optional.IsDefined(RdbBackupMaxSnapshotCount)) + { + writer.WritePropertyName("rdb-backup-max-snapshot-count"u8); + WriteRdbBackupMaxSnapshotCount(writer, options); + } + if (Optional.IsDefined(RdbStorageConnectionString)) + { + writer.WritePropertyName("rdb-storage-connection-string"u8); + writer.WriteStringValue(RdbStorageConnectionString); + } + if (Optional.IsDefined(IsAofBackupEnabled)) + { + writer.WritePropertyName("aof-backup-enabled"u8); + writer.WriteBooleanValue(IsAofBackupEnabled.Value); + } + if (Optional.IsDefined(AofStorageConnectionString0)) + { + writer.WritePropertyName("aof-storage-connection-string-0"u8); + writer.WriteStringValue(AofStorageConnectionString0); + } + if (Optional.IsDefined(AofStorageConnectionString1)) + { + writer.WritePropertyName("aof-storage-connection-string-1"u8); + writer.WriteStringValue(AofStorageConnectionString1); + } + if (Optional.IsDefined(MaxfragmentationmemoryReserved)) + { + writer.WritePropertyName("maxfragmentationmemory-reserved"u8); + writer.WriteStringValue(MaxfragmentationmemoryReserved); + } + if (Optional.IsDefined(MaxmemoryPolicy)) + { + writer.WritePropertyName("maxmemory-policy"u8); + writer.WriteStringValue(MaxmemoryPolicy); + } + if (Optional.IsDefined(MaxmemoryReserved)) + { + writer.WritePropertyName("maxmemory-reserved"u8); + writer.WriteStringValue(MaxmemoryReserved); + } + if (Optional.IsDefined(MaxmemoryDelta)) + { + writer.WritePropertyName("maxmemory-delta"u8); + writer.WriteStringValue(MaxmemoryDelta); + } + if (options.Format != "W" && Optional.IsDefined(Maxclients)) + { + writer.WritePropertyName("maxclients"u8); + writer.WriteStringValue(Maxclients); + } + if (Optional.IsDefined(NotifyKeyspaceEvents)) + { + writer.WritePropertyName("notify-keyspace-events"u8); + writer.WriteStringValue(NotifyKeyspaceEvents); + } + if (options.Format != "W" && Optional.IsDefined(PreferredDataArchiveAuthMethod)) + { + writer.WritePropertyName("preferred-data-archive-auth-method"u8); + writer.WriteStringValue(PreferredDataArchiveAuthMethod); + } + if (Optional.IsDefined(PreferredDataPersistenceAuthMethod)) + { + writer.WritePropertyName("preferred-data-persistence-auth-method"u8); + writer.WriteStringValue(PreferredDataPersistenceAuthMethod); + } + if (options.Format != "W" && Optional.IsDefined(ZonalConfiguration)) + { + writer.WritePropertyName("zonal-configuration"u8); + writer.WriteStringValue(ZonalConfiguration); + } + if (Optional.IsDefined(Authnotrequired)) + { + writer.WritePropertyName("authnotrequired"u8); + writer.WriteStringValue(Authnotrequired); + } + if (Optional.IsDefined(StorageSubscriptionId)) + { + 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); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + + RedisCommonConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RedisCommonConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRedisCommonConfiguration(document.RootElement, options); + } + + internal static RedisCommonConfiguration DeserializeRedisCommonConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? rdbBackupEnabled = default; + string rdbBackupFrequency = default; + int? rdbBackupMaxSnapshotCount = default; + string rdbStorageConnectionString = default; + bool? aofBackupEnabled = default; + string aofStorageConnectionString0 = default; + string aofStorageConnectionString1 = default; + string maxfragmentationmemoryReserved = default; + string maxmemoryPolicy = default; + string maxmemoryReserved = default; + string maxmemoryDelta = default; + string maxclients = default; + string notifyKeyspaceEvents = default; + string preferredDataArchiveAuthMethod = default; + string preferredDataPersistenceAuthMethod = default; + string zonalConfiguration = default; + string authnotrequired = default; + string storageSubscriptionId = default; + string aadEnabled = default; + IDictionary additionalProperties = default; + Dictionary additionalPropertiesDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("rdb-backup-enabled"u8)) + { + ReadIsRdbBackupEnabled(property, ref rdbBackupEnabled); + continue; + } + if (property.NameEquals("rdb-backup-frequency"u8)) + { + rdbBackupFrequency = property.Value.GetString(); + continue; + } + if (property.NameEquals("rdb-backup-max-snapshot-count"u8)) + { + ReadRdbBackupMaxSnapshotCount(property, ref rdbBackupMaxSnapshotCount); + continue; + } + if (property.NameEquals("rdb-storage-connection-string"u8)) + { + rdbStorageConnectionString = property.Value.GetString(); + continue; + } + if (property.NameEquals("aof-backup-enabled"u8)) + { + ReadIsAofBackupEnabled(property, ref aofBackupEnabled); + continue; + } + if (property.NameEquals("aof-storage-connection-string-0"u8)) + { + aofStorageConnectionString0 = property.Value.GetString(); + continue; + } + if (property.NameEquals("aof-storage-connection-string-1"u8)) + { + aofStorageConnectionString1 = property.Value.GetString(); + continue; + } + if (property.NameEquals("maxfragmentationmemory-reserved"u8)) + { + maxfragmentationmemoryReserved = property.Value.GetString(); + continue; + } + if (property.NameEquals("maxmemory-policy"u8)) + { + maxmemoryPolicy = property.Value.GetString(); + continue; + } + if (property.NameEquals("maxmemory-reserved"u8)) + { + maxmemoryReserved = property.Value.GetString(); + continue; + } + if (property.NameEquals("maxmemory-delta"u8)) + { + maxmemoryDelta = property.Value.GetString(); + continue; + } + if (property.NameEquals("maxclients"u8)) + { + maxclients = property.Value.GetString(); + continue; + } + if (property.NameEquals("notify-keyspace-events"u8)) + { + notifyKeyspaceEvents = property.Value.GetString(); + continue; + } + if (property.NameEquals("preferred-data-archive-auth-method"u8)) + { + preferredDataArchiveAuthMethod = property.Value.GetString(); + continue; + } + if (property.NameEquals("preferred-data-persistence-auth-method"u8)) + { + preferredDataPersistenceAuthMethod = property.Value.GetString(); + continue; + } + if (property.NameEquals("zonal-configuration"u8)) + { + zonalConfiguration = property.Value.GetString(); + continue; + } + if (property.NameEquals("authnotrequired"u8)) + { + authnotrequired = property.Value.GetString(); + continue; + } + if (property.NameEquals("storage-subscription-id"u8)) + { + 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( + rdbBackupEnabled, + rdbBackupFrequency, + rdbBackupMaxSnapshotCount, + rdbStorageConnectionString, + aofBackupEnabled, + aofStorageConnectionString0, + aofStorageConnectionString1, + maxfragmentationmemoryReserved, + maxmemoryPolicy, + maxmemoryReserved, + maxmemoryDelta, + maxclients, + notifyKeyspaceEvents, + preferredDataArchiveAuthMethod, + preferredDataPersistenceAuthMethod, + zonalConfiguration, + authnotrequired, + storageSubscriptionId, + aadEnabled, + additionalProperties); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + default: + throw new FormatException($"The model {nameof(RedisCommonConfiguration)} does not support writing '{options.Format}' format."); + } + } + + RedisCommonConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRedisCommonConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RedisCommonConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.cs new file mode 100644 index 000000000000..a55d49274f3e --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Redis.Models +{ + /// All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta, maxmemory-policy,notify-keyspace-events, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-1 etc. + public partial class RedisCommonConfiguration + { + /// Initializes a new instance of . + public RedisCommonConfiguration() + { + AdditionalProperties = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// 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. + /// The keyspace events which should be monitored. + /// 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; you should never disable authentication using this property!. + /// 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 notifyKeyspaceEvents, string preferredDataArchiveAuthMethod, string preferredDataPersistenceAuthMethod, string zonalConfiguration, string authnotrequired, string storageSubscriptionId, string isAadEnabled, IDictionary additionalProperties) + { + IsRdbBackupEnabled = isRdbBackupEnabled; + RdbBackupFrequency = rdbBackupFrequency; + RdbBackupMaxSnapshotCount = rdbBackupMaxSnapshotCount; + RdbStorageConnectionString = rdbStorageConnectionString; + IsAofBackupEnabled = isAofBackupEnabled; + AofStorageConnectionString0 = aofStorageConnectionString0; + AofStorageConnectionString1 = aofStorageConnectionString1; + MaxfragmentationmemoryReserved = maxfragmentationmemoryReserved; + MaxmemoryPolicy = maxmemoryPolicy; + MaxmemoryReserved = maxmemoryReserved; + MaxmemoryDelta = maxmemoryDelta; + Maxclients = maxclients; + NotifyKeyspaceEvents = notifyKeyspaceEvents; + PreferredDataArchiveAuthMethod = preferredDataArchiveAuthMethod; + PreferredDataPersistenceAuthMethod = preferredDataPersistenceAuthMethod; + ZonalConfiguration = zonalConfiguration; + Authnotrequired = authnotrequired; + StorageSubscriptionId = storageSubscriptionId; + IsAadEnabled = isAadEnabled; + AdditionalProperties = additionalProperties; + } + + /// Specifies whether the RDB backup is enabled. + public bool? IsRdbBackupEnabled { get; set; } + /// Specifies the frequency for creating rdb backup in minutes. Valid values: (15, 30, 60, 360, 720, 1440). + public string RdbBackupFrequency { get; set; } + /// Specifies the maximum number of snapshots for rdb backup. + public int? RdbBackupMaxSnapshotCount { get; set; } + /// The storage account connection string for storing rdb file. + public string RdbStorageConnectionString { get; set; } + /// Specifies whether the aof backup is enabled. + public bool? IsAofBackupEnabled { get; set; } + /// First storage account connection string. + public string AofStorageConnectionString0 { get; set; } + /// Second storage account connection string. + public string AofStorageConnectionString1 { get; set; } + /// Value in megabytes reserved for fragmentation per shard. + public string MaxfragmentationmemoryReserved { get; set; } + /// The eviction strategy used when your data won't fit within its memory limit. + public string MaxmemoryPolicy { get; set; } + /// Value in megabytes reserved for non-cache usage per shard e.g. failover. + public string MaxmemoryReserved { get; set; } + /// Value in megabytes reserved for non-cache usage per shard e.g. failover. + public string MaxmemoryDelta { get; set; } + /// The max clients config. + public string Maxclients { get; } + /// The keyspace events which should be monitored. + public string NotifyKeyspaceEvents { get; set; } + /// Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. + public string PreferredDataArchiveAuthMethod { get; } + /// Preferred auth method to communicate to storage account used for data persistence, specify SAS or ManagedIdentity, default value is SAS. + public string PreferredDataPersistenceAuthMethod { get; set; } + /// Zonal Configuration. + public string ZonalConfiguration { get; } + /// Specifies whether the authentication is disabled. Setting this property is highly discouraged from security point of view; you should never disable authentication using this property!. + 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 + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public IDictionary AdditionalProperties { get; } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisDayOfWeek.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisDayOfWeek.Serialization.cs new file mode 100644 index 000000000000..1bd8f1eb0380 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisDayOfWeek.Serialization.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Redis.Models +{ + internal static partial class RedisDayOfWeekExtensions + { + public static string ToSerialString(this RedisDayOfWeek value) => value switch + { + RedisDayOfWeek.Monday => "Monday", + RedisDayOfWeek.Tuesday => "Tuesday", + RedisDayOfWeek.Wednesday => "Wednesday", + RedisDayOfWeek.Thursday => "Thursday", + RedisDayOfWeek.Friday => "Friday", + RedisDayOfWeek.Saturday => "Saturday", + RedisDayOfWeek.Sunday => "Sunday", + RedisDayOfWeek.Everyday => "Everyday", + RedisDayOfWeek.Weekend => "Weekend", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisDayOfWeek value.") + }; + + public static RedisDayOfWeek ToRedisDayOfWeek(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Monday")) return RedisDayOfWeek.Monday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Tuesday")) return RedisDayOfWeek.Tuesday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Wednesday")) return RedisDayOfWeek.Wednesday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Thursday")) return RedisDayOfWeek.Thursday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Friday")) return RedisDayOfWeek.Friday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Saturday")) return RedisDayOfWeek.Saturday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Sunday")) return RedisDayOfWeek.Sunday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Everyday")) return RedisDayOfWeek.Everyday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Weekend")) return RedisDayOfWeek.Weekend; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisDayOfWeek value."); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DayOfWeek.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisDayOfWeek.cs similarity index 96% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DayOfWeek.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisDayOfWeek.cs index aaaed604b6d7..b83128d12b78 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/DayOfWeek.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisDayOfWeek.cs @@ -8,7 +8,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Day of the week when a cache can be patched. - public enum DayOfWeek + public enum RedisDayOfWeek { /// Monday. Monday, diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResponse.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.Serialization.cs similarity index 66% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResponse.Serialization.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.Serialization.cs index 6d115a1cdab4..6ee8f737c1c8 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResponse.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Redis.Models { - public partial class RedisForceRebootResponse : IUtf8JsonSerializable, IJsonModel + public partial class RedisForceRebootResult : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(RedisForceRebootResponse)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(RedisForceRebootResult)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(Message)) @@ -56,19 +56,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - RedisForceRebootResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + RedisForceRebootResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(RedisForceRebootResponse)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(RedisForceRebootResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisForceRebootResponse(document.RootElement, options); + return DeserializeRedisForceRebootResult(document.RootElement, options); } - internal static RedisForceRebootResponse DeserializeRedisForceRebootResponse(JsonElement element, ModelReaderWriterOptions options = null) + internal static RedisForceRebootResult DeserializeRedisForceRebootResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -92,38 +92,38 @@ internal static RedisForceRebootResponse DeserializeRedisForceRebootResponse(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new RedisForceRebootResponse(message, serializedAdditionalRawData); + return new RedisForceRebootResult(message, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); default: - throw new FormatException($"The model {nameof(RedisForceRebootResponse)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisForceRebootResult)} does not support writing '{options.Format}' format."); } } - RedisForceRebootResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + RedisForceRebootResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisForceRebootResponse(document.RootElement, options); + return DeserializeRedisForceRebootResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(RedisForceRebootResponse)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisForceRebootResult)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResponse.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.cs similarity index 88% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResponse.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.cs index 27f0813339d8..10a927d87c38 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResponse.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Response to force reboot for Redis cache. - public partial class RedisForceRebootResponse + public partial class RedisForceRebootResult { /// /// Keeps track of any properties unknown to the library. @@ -45,15 +45,15 @@ public partial class RedisForceRebootResponse /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal RedisForceRebootResponse() + /// Initializes a new instance of . + internal RedisForceRebootResult() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Status message. /// Keeps track of any properties unknown to the library. - internal RedisForceRebootResponse(string message, IDictionary serializedAdditionalRawData) + internal RedisForceRebootResult(string message, IDictionary serializedAdditionalRawData) { Message = message; _serializedAdditionalRawData = serializedAdditionalRawData; diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisKeyType.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisKeyType.Serialization.cs deleted file mode 100644 index 96c36d69b65d..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisKeyType.Serialization.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Redis.Models -{ - internal static partial class RedisKeyTypeExtensions - { - public static string ToSerialString(this RedisKeyType value) => value switch - { - RedisKeyType.Primary => "Primary", - RedisKeyType.Secondary => "Secondary", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisKeyType value.") - }; - - public static RedisKeyType ToRedisKeyType(this string value) - { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Primary")) return RedisKeyType.Primary; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Secondary")) return RedisKeyType.Secondary; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisKeyType value."); - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerRole.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerRole.Serialization.cs new file mode 100644 index 000000000000..5caa670a7475 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerRole.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Redis.Models +{ + internal static partial class RedisLinkedServerRoleExtensions + { + public static string ToSerialString(this RedisLinkedServerRole value) => value switch + { + RedisLinkedServerRole.Primary => "Primary", + RedisLinkedServerRole.Secondary => "Secondary", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisLinkedServerRole value.") + }; + + public static RedisLinkedServerRole ToRedisLinkedServerRole(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Primary")) return RedisLinkedServerRole.Primary; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Secondary")) return RedisLinkedServerRole.Secondary; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisLinkedServerRole value."); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ReplicationRole.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerRole.cs similarity index 92% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ReplicationRole.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerRole.cs index ef4023d3ffbc..db47231986ea 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ReplicationRole.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerRole.cs @@ -8,7 +8,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Role of the linked server. - public enum ReplicationRole + public enum RedisLinkedServerRole { /// The linked server is in the writable primary role *. Primary, diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.Serialization.cs index 422a78ae6545..68ad6a8d7059 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.Serialization.cs @@ -92,7 +92,7 @@ internal static RedisLinkedServerWithPropertyCreateOrUpdateContent DeserializeRe } string linkedRedisCacheId = default; string linkedRedisCacheLocation = default; - ReplicationRole serverRole = default; + RedisLinkedServerRole serverRole = default; string geoReplicatedPrimaryHostName = default; string primaryHostName = default; IDictionary serializedAdditionalRawData = default; @@ -120,7 +120,7 @@ internal static RedisLinkedServerWithPropertyCreateOrUpdateContent DeserializeRe } if (property0.NameEquals("serverRole"u8)) { - serverRole = property0.Value.GetString().ToReplicationRole(); + serverRole = property0.Value.GetString().ToRedisLinkedServerRole(); continue; } if (property0.NameEquals("geoReplicatedPrimaryHostName"u8)) diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.cs index b7807a71b018..f1edfb21a3a4 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.cs @@ -50,7 +50,7 @@ public partial class RedisLinkedServerWithPropertyCreateOrUpdateContent /// Location of the linked redis cache. /// Role of the linked server. /// or is null. - public RedisLinkedServerWithPropertyCreateOrUpdateContent(string linkedRedisCacheId, string linkedRedisCacheLocation, ReplicationRole serverRole) + public RedisLinkedServerWithPropertyCreateOrUpdateContent(string linkedRedisCacheId, string linkedRedisCacheLocation, RedisLinkedServerRole serverRole) { Argument.AssertNotNull(linkedRedisCacheId, nameof(linkedRedisCacheId)); Argument.AssertNotNull(linkedRedisCacheLocation, nameof(linkedRedisCacheLocation)); @@ -67,7 +67,7 @@ public RedisLinkedServerWithPropertyCreateOrUpdateContent(string linkedRedisCach /// The unchanging DNS name which will always point to current geo-primary cache among the linked redis caches for seamless Geo Failover experience. /// The changing DNS name that resolves to the current geo-primary cache among the linked redis caches before or after the Geo Failover. /// Keeps track of any properties unknown to the library. - internal RedisLinkedServerWithPropertyCreateOrUpdateContent(string linkedRedisCacheId, string linkedRedisCacheLocation, ReplicationRole serverRole, string geoReplicatedPrimaryHostName, string primaryHostName, IDictionary serializedAdditionalRawData) + internal RedisLinkedServerWithPropertyCreateOrUpdateContent(string linkedRedisCacheId, string linkedRedisCacheLocation, RedisLinkedServerRole serverRole, string geoReplicatedPrimaryHostName, string primaryHostName, IDictionary serializedAdditionalRawData) { LinkedRedisCacheId = linkedRedisCacheId; LinkedRedisCacheLocation = linkedRedisCacheLocation; @@ -87,7 +87,7 @@ internal RedisLinkedServerWithPropertyCreateOrUpdateContent() /// Location of the linked redis cache. public string LinkedRedisCacheLocation { get; } /// Role of the linked server. - public ReplicationRole ServerRole { get; } + public RedisLinkedServerRole ServerRole { get; } /// The unchanging DNS name which will always point to current geo-primary cache among the linked redis caches for seamless Geo Failover experience. public string GeoReplicatedPrimaryHostName { get; } /// The changing DNS name that resolves to the current geo-primary cache among the linked redis caches before or after the Geo Failover. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/CheckNameAvailabilityContent.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.Serialization.cs similarity index 75% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/CheckNameAvailabilityContent.Serialization.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.Serialization.cs index 213a782ee9fa..ea5371c54ff6 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/CheckNameAvailabilityContent.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Redis.Models { - public partial class CheckNameAvailabilityContent : IUtf8JsonSerializable, IJsonModel + public partial class RedisNameAvailabilityContent : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CheckNameAvailabilityContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(RedisNameAvailabilityContent)} does not support writing '{format}' format."); } writer.WritePropertyName("name"u8); @@ -55,19 +55,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CheckNameAvailabilityContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + RedisNameAvailabilityContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(CheckNameAvailabilityContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(RedisNameAvailabilityContent)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCheckNameAvailabilityContent(document.RootElement, options); + return DeserializeRedisNameAvailabilityContent(document.RootElement, options); } - internal static CheckNameAvailabilityContent DeserializeCheckNameAvailabilityContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static RedisNameAvailabilityContent DeserializeRedisNameAvailabilityContent(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -97,38 +97,38 @@ internal static CheckNameAvailabilityContent DeserializeCheckNameAvailabilityCon } } serializedAdditionalRawData = rawDataDictionary; - return new CheckNameAvailabilityContent(name, type, serializedAdditionalRawData); + return new RedisNameAvailabilityContent(name, type, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); default: - throw new FormatException($"The model {nameof(CheckNameAvailabilityContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisNameAvailabilityContent)} does not support writing '{options.Format}' format."); } } - CheckNameAvailabilityContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + RedisNameAvailabilityContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCheckNameAvailabilityContent(document.RootElement, options); + return DeserializeRedisNameAvailabilityContent(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CheckNameAvailabilityContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisNameAvailabilityContent)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/CheckNameAvailabilityContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.cs similarity index 84% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/CheckNameAvailabilityContent.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.cs index 29838bee9f73..2bb49d4668db 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/CheckNameAvailabilityContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Parameters body to pass for resource name availability check. - public partial class CheckNameAvailabilityContent + public partial class RedisNameAvailabilityContent { /// /// Keeps track of any properties unknown to the library. @@ -45,11 +45,11 @@ public partial class CheckNameAvailabilityContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Resource name. /// Resource type. The only legal value of this property for checking redis cache name availability is 'Microsoft.Cache/redis'. /// or is null. - public CheckNameAvailabilityContent(string name, string type) + public RedisNameAvailabilityContent(string name, string type) { Argument.AssertNotNull(name, nameof(name)); Argument.AssertNotNull(type, nameof(type)); @@ -58,19 +58,19 @@ public CheckNameAvailabilityContent(string name, string type) Type = type; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Resource name. /// Resource type. The only legal value of this property for checking redis cache name availability is 'Microsoft.Cache/redis'. /// Keeps track of any properties unknown to the library. - internal CheckNameAvailabilityContent(string name, string type, IDictionary serializedAdditionalRawData) + internal RedisNameAvailabilityContent(string name, string type, IDictionary serializedAdditionalRawData) { Name = name; Type = type; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal CheckNameAvailabilityContent() + /// Initializes a new instance of for deserialization. + internal RedisNameAvailabilityContent() { } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatus.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.Serialization.cs similarity index 80% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatus.Serialization.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.Serialization.cs index f910424aac44..c586d20dfc72 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatus.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.Redis.Models { - public partial class OperationStatus : IUtf8JsonSerializable, IJsonModel + public partial class RedisOperationStatus : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -29,10 +29,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(OperationStatus)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(RedisOperationStatus)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -61,19 +61,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - OperationStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + RedisOperationStatus IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(OperationStatus)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(RedisOperationStatus)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOperationStatus(document.RootElement, options); + return DeserializeRedisOperationStatus(document.RootElement, options); } - internal static OperationStatus DeserializeOperationStatus(JsonElement element, ModelReaderWriterOptions options = null) + internal static RedisOperationStatus DeserializeRedisOperationStatus(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -186,7 +186,7 @@ internal static OperationStatus DeserializeOperationStatus(JsonElement element, } } serializedAdditionalRawData = rawDataDictionary; - return new OperationStatus( + return new RedisOperationStatus( id, name, status, @@ -199,35 +199,35 @@ internal static OperationStatus DeserializeOperationStatus(JsonElement element, properties ?? new ChangeTrackingDictionary()); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); default: - throw new FormatException($"The model {nameof(OperationStatus)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisOperationStatus)} does not support writing '{options.Format}' format."); } } - OperationStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + RedisOperationStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOperationStatus(document.RootElement, options); + return DeserializeRedisOperationStatus(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(OperationStatus)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisOperationStatus)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatus.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.cs similarity index 75% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatus.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.cs index 0a71b9e3b98f..32600c7f57b5 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatus.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.cs @@ -11,19 +11,19 @@ namespace Azure.ResourceManager.Redis.Models { /// Asynchronous operation status. - public partial class OperationStatus : OperationStatusResult + public partial class RedisOperationStatus : OperationStatusResult { - /// Initializes a new instance of . + /// Initializes a new instance of . /// Operation status. /// is null. - internal OperationStatus(string status) : base(status) + internal RedisOperationStatus(string status) : base(status) { Argument.AssertNotNull(status, nameof(status)); Properties = new ChangeTrackingDictionary(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Fully qualified ID for the async operation. /// Name of the async operation. /// Operation status. @@ -34,13 +34,13 @@ internal OperationStatus(string status) : base(status) /// If present, details of the operation error. /// Keeps track of any properties unknown to the library. /// Additional properties from RP, only when operation is successful. - internal OperationStatus(string id, string name, string status, double? percentComplete, DateTimeOffset? startOn, DateTimeOffset? endOn, IReadOnlyList operations, ResponseError error, IDictionary serializedAdditionalRawData, IReadOnlyDictionary properties) : base(id, name, status, percentComplete, startOn, endOn, operations, error, serializedAdditionalRawData) + internal RedisOperationStatus(string id, string name, string status, double? percentComplete, DateTimeOffset? startOn, DateTimeOffset? endOn, IReadOnlyList operations, ResponseError error, IDictionary serializedAdditionalRawData, IReadOnlyDictionary properties) : base(id, name, status, percentComplete, startOn, endOn, operations, error, serializedAdditionalRawData) { Properties = properties; } - /// Initializes a new instance of for deserialization. - internal OperationStatus() + /// Initializes a new instance of for deserialization. + internal RedisOperationStatus() { } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourcePatch.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.Serialization.cs similarity index 78% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourcePatch.Serialization.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.Serialization.cs index 875c7355c974..5e371ab11ce4 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourcePatch.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.Redis.Models { - public partial class RedisResourcePatch : IUtf8JsonSerializable, IJsonModel + public partial class RedisPatch : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -30,10 +30,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(RedisResourcePatch)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(RedisPatch)} does not support writing '{format}' format."); } if (Optional.IsCollectionDefined(Tags)) @@ -77,19 +77,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - RedisResourcePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + RedisPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(RedisResourcePatch)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(RedisPatch)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisResourcePatch(document.RootElement, options); + return DeserializeRedisPatch(document.RootElement, options); } - internal static RedisResourcePatch DeserializeRedisResourcePatch(JsonElement element, ModelReaderWriterOptions options = null) + internal static RedisPatch DeserializeRedisPatch(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -154,38 +154,38 @@ internal static RedisResourcePatch DeserializeRedisResourcePatch(JsonElement ele } } serializedAdditionalRawData = rawDataDictionary; - return new RedisResourcePatch(sku, tags ?? new ChangeTrackingDictionary(), identity, serializedAdditionalRawData); + return new RedisPatch(sku, tags ?? new ChangeTrackingDictionary(), identity, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); default: - throw new FormatException($"The model {nameof(RedisResourcePatch)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisPatch)} does not support writing '{options.Format}' format."); } } - RedisResourcePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + RedisPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisResourcePatch(document.RootElement, options); + return DeserializeRedisPatch(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(RedisResourcePatch)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisPatch)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourcePatch.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.cs similarity index 89% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourcePatch.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.cs index b26fdb129686..e5fd1fec8cec 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourcePatch.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Parameters supplied to the Update Redis operation. - public partial class RedisResourcePatch + public partial class RedisPatch { /// /// Keeps track of any properties unknown to the library. @@ -46,18 +46,18 @@ public partial class RedisResourcePatch /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public RedisResourcePatch() + /// Initializes a new instance of . + public RedisPatch() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The SKU of the Redis cache to deploy. /// Resource tags. /// The identity of the resource. /// Keeps track of any properties unknown to the library. - internal RedisResourcePatch(RedisSku sku, IDictionary tags, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) + internal RedisPatch(RedisSku sku, IDictionary tags, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) { Sku = sku; Tags = tags; diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleDefaultName.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleDefaultName.cs new file mode 100644 index 000000000000..2afd4d2a13c9 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleDefaultName.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Redis.Models +{ + /// The name of the resource that is the target of a particular operation. For singleton resources, it must be 'Default'. + public readonly partial struct RedisPatchScheduleDefaultName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RedisPatchScheduleDefaultName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "default"; + + /// The name of e.g. the patch schedules resource, which is a singleton, must always be 'Default' *. + public static RedisPatchScheduleDefaultName Default { get; } = new RedisPatchScheduleDefaultName(DefaultValue); + /// Determines if two values are the same. + public static bool operator ==(RedisPatchScheduleDefaultName left, RedisPatchScheduleDefaultName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RedisPatchScheduleDefaultName left, RedisPatchScheduleDefaultName right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RedisPatchScheduleDefaultName(string value) => new RedisPatchScheduleDefaultName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RedisPatchScheduleDefaultName other && Equals(other); + /// + public bool Equals(RedisPatchScheduleDefaultName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ScheduleEntry.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.Serialization.cs similarity index 67% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ScheduleEntry.Serialization.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.Serialization.cs index 87598fbe4d7b..05ed2981fc4d 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ScheduleEntry.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Redis.Models { - public partial class ScheduleEntry : IUtf8JsonSerializable, IJsonModel + public partial class RedisPatchScheduleSetting : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ScheduleEntry)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(RedisPatchScheduleSetting)} does not support writing '{format}' format."); } writer.WritePropertyName("dayOfWeek"u8); @@ -60,19 +60,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ScheduleEntry IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + RedisPatchScheduleSetting IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ScheduleEntry)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(RedisPatchScheduleSetting)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeScheduleEntry(document.RootElement, options); + return DeserializeRedisPatchScheduleSetting(document.RootElement, options); } - internal static ScheduleEntry DeserializeScheduleEntry(JsonElement element, ModelReaderWriterOptions options = null) + internal static RedisPatchScheduleSetting DeserializeRedisPatchScheduleSetting(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -80,7 +80,7 @@ internal static ScheduleEntry DeserializeScheduleEntry(JsonElement element, Mode { return null; } - DayOfWeek dayOfWeek = default; + RedisDayOfWeek dayOfWeek = default; int startHourUtc = default; TimeSpan? maintenanceWindow = default; IDictionary serializedAdditionalRawData = default; @@ -89,7 +89,7 @@ internal static ScheduleEntry DeserializeScheduleEntry(JsonElement element, Mode { if (property.NameEquals("dayOfWeek"u8)) { - dayOfWeek = property.Value.GetString().ToDayOfWeek(); + dayOfWeek = property.Value.GetString().ToRedisDayOfWeek(); continue; } if (property.NameEquals("startHourUtc"u8)) @@ -112,38 +112,38 @@ internal static ScheduleEntry DeserializeScheduleEntry(JsonElement element, Mode } } serializedAdditionalRawData = rawDataDictionary; - return new ScheduleEntry(dayOfWeek, startHourUtc, maintenanceWindow, serializedAdditionalRawData); + return new RedisPatchScheduleSetting(dayOfWeek, startHourUtc, maintenanceWindow, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); default: - throw new FormatException($"The model {nameof(ScheduleEntry)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisPatchScheduleSetting)} does not support writing '{options.Format}' format."); } } - ScheduleEntry IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + RedisPatchScheduleSetting IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeScheduleEntry(document.RootElement, options); + return DeserializeRedisPatchScheduleSetting(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ScheduleEntry)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisPatchScheduleSetting)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ScheduleEntry.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.cs similarity index 80% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ScheduleEntry.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.cs index 5c8da2369572..eb4709346d64 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ScheduleEntry.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Patch schedule entry for a Premium Redis Cache. - public partial class ScheduleEntry + public partial class RedisPatchScheduleSetting { /// /// Keeps track of any properties unknown to the library. @@ -45,21 +45,21 @@ public partial class ScheduleEntry /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Day of the week when a cache can be patched. /// Start hour after which cache patching can start. - public ScheduleEntry(DayOfWeek dayOfWeek, int startHourUtc) + public RedisPatchScheduleSetting(RedisDayOfWeek dayOfWeek, int startHourUtc) { DayOfWeek = dayOfWeek; StartHourUtc = startHourUtc; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Day of the week when a cache can be patched. /// Start hour after which cache patching can start. /// ISO8601 timespan specifying how much time cache patching can take. /// Keeps track of any properties unknown to the library. - internal ScheduleEntry(DayOfWeek dayOfWeek, int startHourUtc, TimeSpan? maintenanceWindow, IDictionary serializedAdditionalRawData) + internal RedisPatchScheduleSetting(RedisDayOfWeek dayOfWeek, int startHourUtc, TimeSpan? maintenanceWindow, IDictionary serializedAdditionalRawData) { DayOfWeek = dayOfWeek; StartHourUtc = startHourUtc; @@ -67,13 +67,13 @@ internal ScheduleEntry(DayOfWeek dayOfWeek, int startHourUtc, TimeSpan? maintena _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ScheduleEntry() + /// Initializes a new instance of for deserialization. + internal RedisPatchScheduleSetting() { } /// Day of the week when a cache can be patched. - public DayOfWeek DayOfWeek { get; set; } + public RedisDayOfWeek DayOfWeek { get; set; } /// Start hour after which cache patching can start. public int StartHourUtc { get; set; } /// ISO8601 timespan specifying how much time cache patching can take. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ProvisioningState.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisProvisioningState.cs similarity index 53% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ProvisioningState.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisProvisioningState.cs index 80e1f2efa819..2077e8253503 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ProvisioningState.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisProvisioningState.cs @@ -11,13 +11,13 @@ namespace Azure.ResourceManager.Redis.Models { /// Redis instance provisioning status. - public readonly partial struct ProvisioningState : IEquatable + public readonly partial struct RedisProvisioningState : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public ProvisioningState(string value) + public RedisProvisioningState(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } @@ -37,43 +37,43 @@ public ProvisioningState(string value) private const string ConfiguringAADValue = "ConfiguringAAD"; /// A create operation is in progress. *. - public static ProvisioningState Creating { get; } = new ProvisioningState(CreatingValue); + public static RedisProvisioningState Creating { get; } = new RedisProvisioningState(CreatingValue); /// A delete operation is in progress. *. - public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue); + public static RedisProvisioningState Deleting { get; } = new RedisProvisioningState(DeletingValue); /// The cache is disabled and cannot be used. *. - public static ProvisioningState Disabled { get; } = new ProvisioningState(DisabledValue); + public static RedisProvisioningState Disabled { get; } = new RedisProvisioningState(DisabledValue); /// An operation such as create or update failed. If you failed to create the cache it will not be in a usable state, so you should delete and recreate it. *. - public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + public static RedisProvisioningState Failed { get; } = new RedisProvisioningState(FailedValue); /// Georeplication link is in progress *. - public static ProvisioningState Linking { get; } = new ProvisioningState(LinkingValue); + public static RedisProvisioningState Linking { get; } = new RedisProvisioningState(LinkingValue); /// An operation is in progress *. - public static ProvisioningState Provisioning { get; } = new ProvisioningState(ProvisioningValue); + public static RedisProvisioningState Provisioning { get; } = new RedisProvisioningState(ProvisioningValue); /// A scaling operation encountered an error and recovery is in progress. *. - public static ProvisioningState RecoveringScaleFailure { get; } = new ProvisioningState(RecoveringScaleFailureValue); + public static RedisProvisioningState RecoveringScaleFailure { get; } = new RedisProvisioningState(RecoveringScaleFailureValue); /// A scaling operation is in progress *. - public static ProvisioningState Scaling { get; } = new ProvisioningState(ScalingValue); + public static RedisProvisioningState Scaling { get; } = new RedisProvisioningState(ScalingValue); /// The most recent operation successfully completed *. - public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + public static RedisProvisioningState Succeeded { get; } = new RedisProvisioningState(SucceededValue); /// Georeplication unlink is in progress *. - public static ProvisioningState Unlinking { get; } = new ProvisioningState(UnlinkingValue); + public static RedisProvisioningState Unlinking { get; } = new RedisProvisioningState(UnlinkingValue); /// The cache may be being disabled *. - public static ProvisioningState Unprovisioning { get; } = new ProvisioningState(UnprovisioningValue); + public static RedisProvisioningState Unprovisioning { get; } = new RedisProvisioningState(UnprovisioningValue); /// An update operation is in progress. *. - public static ProvisioningState Updating { get; } = new ProvisioningState(UpdatingValue); + public static RedisProvisioningState Updating { get; } = new RedisProvisioningState(UpdatingValue); /// An AAD configuration update operation is in progress. *. - public static ProvisioningState ConfiguringAAD { get; } = new ProvisioningState(ConfiguringAADValue); - /// Determines if two values are the same. - public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + 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. + public static bool operator !=(RedisProvisioningState left, RedisProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RedisProvisioningState(string value) => new RedisProvisioningState(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + public override bool Equals(object obj) => obj is RedisProvisioningState other && Equals(other); /// - public bool Equals(ProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(RedisProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.Serialization.cs index 23a65b5159d9..82cb85273c17 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.Serialization.cs @@ -91,7 +91,7 @@ internal static RedisRebootContent DeserializeRedisRebootContent(JsonElement ele { return null; } - RebootType? rebootType = default; + RedisRebootType? rebootType = default; int? shardId = default; IList ports = default; IDictionary serializedAdditionalRawData = default; @@ -104,7 +104,7 @@ internal static RedisRebootContent DeserializeRedisRebootContent(JsonElement ele { continue; } - rebootType = new RebootType(property.Value.GetString()); + rebootType = new RedisRebootType(property.Value.GetString()); continue; } if (property.NameEquals("shardId"u8)) diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.cs index fd5f73566052..1c81e87933b7 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.cs @@ -56,7 +56,7 @@ public RedisRebootContent() /// If clustering is enabled, the ID of the shard to be rebooted. /// A list of redis instances to reboot, specified by per-instance SSL ports or non-SSL ports. /// Keeps track of any properties unknown to the library. - internal RedisRebootContent(RebootType? rebootType, int? shardId, IList ports, IDictionary serializedAdditionalRawData) + internal RedisRebootContent(RedisRebootType? rebootType, int? shardId, IList ports, IDictionary serializedAdditionalRawData) { RebootType = rebootType; ShardId = shardId; @@ -65,7 +65,7 @@ internal RedisRebootContent(RebootType? rebootType, int? shardId, IList por } /// Which Redis node(s) to reboot. Depending on this value data loss is possible. - public RebootType? RebootType { get; set; } + public RedisRebootType? RebootType { get; set; } /// If clustering is enabled, the ID of the shard to be rebooted. public int? ShardId { get; set; } /// A list of redis instances to reboot, specified by per-instance SSL ports or non-SSL ports. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RebootType.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootType.cs similarity index 56% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RebootType.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootType.cs index 2cbab95c9f8c..439cf6cb1169 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RebootType.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootType.cs @@ -11,13 +11,13 @@ namespace Azure.ResourceManager.Redis.Models { /// Which Redis node(s) to reboot. Depending on this value data loss is possible. - public readonly partial struct RebootType : IEquatable + public readonly partial struct RedisRebootType : IEquatable { private readonly string _value; - /// Initializes a new instance of . + /// Initializes a new instance of . /// is null. - public RebootType(string value) + public RedisRebootType(string value) { _value = value ?? throw new ArgumentNullException(nameof(value)); } @@ -27,23 +27,23 @@ public RebootType(string value) private const string AllNodesValue = "AllNodes"; /// Reboot the primary nodes used for redis write operations. (This may trigger role changes.) *. - public static RebootType PrimaryNode { get; } = new RebootType(PrimaryNodeValue); + public static RedisRebootType PrimaryNode { get; } = new RedisRebootType(PrimaryNodeValue); /// Reboot only the secondary or replica nodes *. - public static RebootType SecondaryNode { get; } = new RebootType(SecondaryNodeValue); + public static RedisRebootType SecondaryNode { get; } = new RedisRebootType(SecondaryNodeValue); /// Reboot all nodes, not guaranteed to happen simultaneously. *. - public static RebootType AllNodes { get; } = new RebootType(AllNodesValue); - /// Determines if two values are the same. - public static bool operator ==(RebootType left, RebootType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(RebootType left, RebootType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator RebootType(string value) => new RebootType(value); + public static RedisRebootType AllNodes { get; } = new RedisRebootType(AllNodesValue); + /// Determines if two values are the same. + public static bool operator ==(RedisRebootType left, RedisRebootType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RedisRebootType left, RedisRebootType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RedisRebootType(string value) => new RedisRebootType(value); /// [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is RebootType other && Equals(other); + public override bool Equals(object obj) => obj is RedisRebootType other && Equals(other); /// - public bool Equals(RebootType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + public bool Equals(RedisRebootType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); /// [EditorBrowsable(EditorBrowsableState.Never)] diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.Serialization.cs index 5a9c53476476..abfb5ce33b98 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.Serialization.cs @@ -73,14 +73,14 @@ internal static RedisRegenerateKeyContent DeserializeRedisRegenerateKeyContent(J { return null; } - RedisKeyType keyType = default; + RedisRegenerateKeyType keyType = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyType"u8)) { - keyType = property.Value.GetString().ToRedisKeyType(); + keyType = property.Value.GetString().ToRedisRegenerateKeyType(); continue; } if (options.Format != "W") diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.cs index f255e014300f..7c2c4cb1d8c4 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.cs @@ -47,7 +47,7 @@ public partial class RedisRegenerateKeyContent /// Initializes a new instance of . /// The Redis access key to regenerate. - public RedisRegenerateKeyContent(RedisKeyType keyType) + public RedisRegenerateKeyContent(RedisRegenerateKeyType keyType) { KeyType = keyType; } @@ -55,7 +55,7 @@ public RedisRegenerateKeyContent(RedisKeyType keyType) /// Initializes a new instance of . /// The Redis access key to regenerate. /// Keeps track of any properties unknown to the library. - internal RedisRegenerateKeyContent(RedisKeyType keyType, IDictionary serializedAdditionalRawData) + internal RedisRegenerateKeyContent(RedisRegenerateKeyType keyType, IDictionary serializedAdditionalRawData) { KeyType = keyType; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -67,6 +67,6 @@ internal RedisRegenerateKeyContent() } /// The Redis access key to regenerate. - public RedisKeyType KeyType { get; } + public RedisRegenerateKeyType KeyType { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyType.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyType.Serialization.cs new file mode 100644 index 000000000000..ac9e806c38a0 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyType.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Redis.Models +{ + internal static partial class RedisRegenerateKeyTypeExtensions + { + public static string ToSerialString(this RedisRegenerateKeyType value) => value switch + { + RedisRegenerateKeyType.Primary => "Primary", + RedisRegenerateKeyType.Secondary => "Secondary", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisRegenerateKeyType value.") + }; + + public static RedisRegenerateKeyType ToRedisRegenerateKeyType(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Primary")) return RedisRegenerateKeyType.Primary; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Secondary")) return RedisRegenerateKeyType.Secondary; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown RedisRegenerateKeyType value."); + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisKeyType.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyType.cs similarity index 91% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisKeyType.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyType.cs index 4557eda059f7..90ce08c92194 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisKeyType.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyType.cs @@ -8,7 +8,7 @@ namespace Azure.ResourceManager.Redis.Models { /// The Redis access key to regenerate. - public enum RedisKeyType + public enum RedisRegenerateKeyType { /// The primary access key *. Primary, diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSkuFamily.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSkuFamily.cs index 5b0f3410fa13..f8334e2dccec 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSkuFamily.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSkuFamily.cs @@ -22,13 +22,13 @@ public RedisSkuFamily(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string CValue = "C"; - private const string PValue = "P"; + private const string BasicOrStandardValue = "C"; + private const string PremiumValue = "P"; /// The SKU family to use - must be 'C' for Basic/Standard SKU redis caches. *. - public static RedisSkuFamily C { get; } = new RedisSkuFamily(CValue); + public static RedisSkuFamily BasicOrStandard { get; } = new RedisSkuFamily(BasicOrStandardValue); /// The SKU family to use - must be 'P' for Premium SKU redis caches. *. - public static RedisSkuFamily P { get; } = new RedisSkuFamily(PValue); + public static RedisSkuFamily Premium { get; } = new RedisSkuFamily(PremiumValue); /// Determines if two values are the same. public static bool operator ==(RedisSkuFamily left, RedisSkuFamily right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisTlsVersion.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisTlsVersion.cs new file mode 100644 index 000000000000..09455b325640 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisTlsVersion.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Redis.Models +{ + /// Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). + public readonly partial struct RedisTlsVersion : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RedisTlsVersion(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string _10Value = "1.0"; + private const string _11Value = "1.1"; + private const string _12Value = "1.2"; + + /// TLS protocol version 1.0 -- deprecated for security reasons. Do not use this value for new caches. *. + public static RedisTlsVersion _10 { get; } = new RedisTlsVersion(_10Value); + /// TLS protocol version 1.1 -- deprecated for security reasons. Do not use this value for new caches. *. + public static RedisTlsVersion _11 { get; } = new RedisTlsVersion(_11Value); + /// TLS protocol version 1.2 -- use this value, or higher, for new caches. Or do not specify, so that your cache uses the recommended default value. + public static RedisTlsVersion _12 { get; } = new RedisTlsVersion(_12Value); + /// Determines if two values are the same. + public static bool operator ==(RedisTlsVersion left, RedisTlsVersion right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RedisTlsVersion left, RedisTlsVersion right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RedisTlsVersion(string value) => new RedisTlsVersion(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RedisTlsVersion other && Equals(other); + /// + public bool Equals(RedisTlsVersion other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpgradeNotification.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.Serialization.cs similarity index 72% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpgradeNotification.Serialization.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.Serialization.cs index 957385612a05..77d5cdf5085a 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpgradeNotification.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Redis.Models { - public partial class UpgradeNotification : IUtf8JsonSerializable, IJsonModel + public partial class RedisUpgradeNotification : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(UpgradeNotification)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(RedisUpgradeNotification)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(Name)) @@ -72,19 +72,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - UpgradeNotification IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + RedisUpgradeNotification IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(UpgradeNotification)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(RedisUpgradeNotification)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUpgradeNotification(document.RootElement, options); + return DeserializeRedisUpgradeNotification(document.RootElement, options); } - internal static UpgradeNotification DeserializeUpgradeNotification(JsonElement element, ModelReaderWriterOptions options = null) + internal static RedisUpgradeNotification DeserializeRedisUpgradeNotification(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -133,38 +133,38 @@ internal static UpgradeNotification DeserializeUpgradeNotification(JsonElement e } } serializedAdditionalRawData = rawDataDictionary; - return new UpgradeNotification(name, timestamp, upsellNotification ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new RedisUpgradeNotification(name, timestamp, upsellNotification ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); default: - throw new FormatException($"The model {nameof(UpgradeNotification)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisUpgradeNotification)} does not support writing '{options.Format}' format."); } } - UpgradeNotification IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + RedisUpgradeNotification IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeUpgradeNotification(document.RootElement, options); + return DeserializeRedisUpgradeNotification(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(UpgradeNotification)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisUpgradeNotification)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpgradeNotification.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.cs similarity index 84% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpgradeNotification.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.cs index 613f4457f78c..5f1bc18c0c78 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpgradeNotification.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Properties of upgrade notification. - public partial class UpgradeNotification + public partial class RedisUpgradeNotification { /// /// Keeps track of any properties unknown to the library. @@ -45,18 +45,18 @@ public partial class UpgradeNotification /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal UpgradeNotification() + /// Initializes a new instance of . + internal RedisUpgradeNotification() { UpsellNotification = new ChangeTrackingDictionary(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Name of upgrade notification. /// Timestamp when upgrade notification occurred. /// Details about this upgrade notification. /// Keeps track of any properties unknown to the library. - internal UpgradeNotification(string name, DateTimeOffset? timestamp, IReadOnlyDictionary upsellNotification, IDictionary serializedAdditionalRawData) + internal RedisUpgradeNotification(string name, DateTimeOffset? timestamp, IReadOnlyDictionary upsellNotification, IDictionary serializedAdditionalRawData) { Name = name; Timestamp = timestamp; diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/NotificationListResponse.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.Serialization.cs similarity index 63% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/NotificationListResponse.Serialization.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.Serialization.cs index 3cb716d54086..9273dff945a2 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/NotificationListResponse.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Redis.Models { - internal partial class NotificationListResponse : IUtf8JsonSerializable, IJsonModel + internal partial class RedisUpgradeNotificationListResponse : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(NotificationListResponse)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(RedisUpgradeNotificationListResponse)} does not support writing '{format}' format."); } writer.WritePropertyName("value"u8); @@ -63,19 +63,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - NotificationListResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + RedisUpgradeNotificationListResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(NotificationListResponse)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(RedisUpgradeNotificationListResponse)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeNotificationListResponse(document.RootElement, options); + return DeserializeRedisUpgradeNotificationListResponse(document.RootElement, options); } - internal static NotificationListResponse DeserializeNotificationListResponse(JsonElement element, ModelReaderWriterOptions options = null) + internal static RedisUpgradeNotificationListResponse DeserializeRedisUpgradeNotificationListResponse(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -83,7 +83,7 @@ internal static NotificationListResponse DeserializeNotificationListResponse(Jso { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -91,10 +91,10 @@ internal static NotificationListResponse DeserializeNotificationListResponse(Jso { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(UpgradeNotification.DeserializeUpgradeNotification(item, options)); + array.Add(RedisUpgradeNotification.DeserializeRedisUpgradeNotification(item, options)); } value = array; continue; @@ -114,38 +114,38 @@ internal static NotificationListResponse DeserializeNotificationListResponse(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new NotificationListResponse(value, nextLink, serializedAdditionalRawData); + return new RedisUpgradeNotificationListResponse(value, nextLink, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); default: - throw new FormatException($"The model {nameof(NotificationListResponse)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisUpgradeNotificationListResponse)} does not support writing '{options.Format}' format."); } } - NotificationListResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + RedisUpgradeNotificationListResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeNotificationListResponse(document.RootElement, options); + return DeserializeRedisUpgradeNotificationListResponse(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(NotificationListResponse)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisUpgradeNotificationListResponse)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/NotificationListResponse.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.cs similarity index 76% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/NotificationListResponse.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.cs index c8ba9740c58e..dac4121ab719 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/NotificationListResponse.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Redis.Models { /// The response of listUpgradeNotifications. - internal partial class NotificationListResponse + internal partial class RedisUpgradeNotificationListResponse { /// /// Keeps track of any properties unknown to the library. @@ -46,34 +46,34 @@ internal partial class NotificationListResponse /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// The UpgradeNotification items on this page. /// is null. - internal NotificationListResponse(IEnumerable value) + internal RedisUpgradeNotificationListResponse(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); Value = value.ToList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The UpgradeNotification items on this page. /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal NotificationListResponse(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal RedisUpgradeNotificationListResponse(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal NotificationListResponse() + /// Initializes a new instance of for deserialization. + internal RedisUpgradeNotificationListResponse() { } /// The UpgradeNotification items on this page. - public IReadOnlyList Value { get; } + public IReadOnlyList Value { get; } /// The link to the next page of items. public Uri NextLink { get; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ReplicationRole.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ReplicationRole.Serialization.cs deleted file mode 100644 index 5934eb414997..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ReplicationRole.Serialization.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Redis.Models -{ - internal static partial class ReplicationRoleExtensions - { - public static string ToSerialString(this ReplicationRole value) => value switch - { - ReplicationRole.Primary => "Primary", - ReplicationRole.Secondary => "Secondary", - _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ReplicationRole value.") - }; - - public static ReplicationRole ToReplicationRole(this string value) - { - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Primary")) return ReplicationRole.Primary; - if (StringComparer.OrdinalIgnoreCase.Equals(value, "Secondary")) return ReplicationRole.Secondary; - throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ReplicationRole value."); - } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.Serialization.cs index db836870b99b..36fed7674442 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.Serialization.cs @@ -48,7 +48,7 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri if (Optional.IsDefined(ObjectId)) { writer.WritePropertyName("objectId"u8); - writer.WriteStringValue(ObjectId); + writer.WriteStringValue(ObjectId.Value); } if (Optional.IsDefined(ObjectIdAlias)) { @@ -88,7 +88,7 @@ internal static RedisCacheAccessPolicyAssignmentData DeserializeRedisCacheAccess ResourceType type = default; SystemData systemData = default; AccessPolicyAssignmentProvisioningState? provisioningState = default; - string objectId = default; + Guid? objectId = default; string objectIdAlias = default; string accessPolicyName = default; IDictionary serializedAdditionalRawData = default; @@ -139,7 +139,11 @@ internal static RedisCacheAccessPolicyAssignmentData DeserializeRedisCacheAccess } if (property0.NameEquals("objectId"u8)) { - objectId = property0.Value.GetString(); + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + objectId = property0.Value.GetGuid(); continue; } if (property0.NameEquals("objectIdAlias"u8)) diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs index 45390b04f1f0..18f06bcb6fc5 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs @@ -66,7 +66,7 @@ public RedisCacheAccessPolicyAssignmentData() /// User friendly name for object id. Also represents username for token based authentication. /// The name of the access policy that is being assigned. /// Keeps track of any properties unknown to the library. - internal RedisCacheAccessPolicyAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AccessPolicyAssignmentProvisioningState? provisioningState, string objectId, string objectIdAlias, string accessPolicyName, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal RedisCacheAccessPolicyAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AccessPolicyAssignmentProvisioningState? provisioningState, Guid? objectId, string objectIdAlias, string accessPolicyName, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; ObjectId = objectId; @@ -78,7 +78,7 @@ internal RedisCacheAccessPolicyAssignmentData(ResourceIdentifier id, string name /// Provisioning state of an access policy assignment set. public AccessPolicyAssignmentProvisioningState? ProvisioningState { get; } /// Object Id to assign access policy to. - public string ObjectId { get; set; } + 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. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleCollection.cs index 1f9e53073d58..5ab56b672df8 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleCollection.cs @@ -78,7 +78,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// Parameters to set the patching schedule for Redis cache. /// The cancellation token to use. /// is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, DefaultName @default, RedisPatchScheduleData data, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, RedisPatchScheduleDefaultName @default, RedisPatchScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); @@ -127,7 +127,7 @@ public virtual async Task> CreateOrUpda /// Parameters to set the patching schedule for Redis cache. /// The cancellation token to use. /// is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, DefaultName @default, RedisPatchScheduleData data, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, RedisPatchScheduleDefaultName @default, RedisPatchScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); @@ -173,7 +173,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil /// /// The name of the RedisPatchSchedule. /// The cancellation token to use. - public virtual async Task> GetAsync(DefaultName @default, CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(RedisPatchScheduleDefaultName @default, CancellationToken cancellationToken = default) { using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleCollection.Get"); scope.Start(); @@ -214,7 +214,7 @@ public virtual async Task> GetAsync(Default /// /// The name of the RedisPatchSchedule. /// The cancellation token to use. - public virtual Response Get(DefaultName @default, CancellationToken cancellationToken = default) + public virtual Response Get(RedisPatchScheduleDefaultName @default, CancellationToken cancellationToken = default) { using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleCollection.Get"); scope.Start(); @@ -315,7 +315,7 @@ public virtual Pageable GetAll(CancellationToken can /// /// The name of the RedisPatchSchedule. /// The cancellation token to use. - public virtual async Task> ExistsAsync(DefaultName @default, CancellationToken cancellationToken = default) + public virtual async Task> ExistsAsync(RedisPatchScheduleDefaultName @default, CancellationToken cancellationToken = default) { using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleCollection.Exists"); scope.Start(); @@ -354,7 +354,7 @@ public virtual async Task> ExistsAsync(DefaultName @default, Canc /// /// The name of the RedisPatchSchedule. /// The cancellation token to use. - public virtual Response Exists(DefaultName @default, CancellationToken cancellationToken = default) + public virtual Response Exists(RedisPatchScheduleDefaultName @default, CancellationToken cancellationToken = default) { using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleCollection.Exists"); scope.Start(); @@ -393,7 +393,7 @@ public virtual Response Exists(DefaultName @default, CancellationToken can /// /// The name of the RedisPatchSchedule. /// The cancellation token to use. - public virtual async Task> GetIfExistsAsync(DefaultName @default, CancellationToken cancellationToken = default) + public virtual async Task> GetIfExistsAsync(RedisPatchScheduleDefaultName @default, CancellationToken cancellationToken = default) { using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleCollection.GetIfExists"); scope.Start(); @@ -434,7 +434,7 @@ public virtual async Task> GetIfExi /// /// The name of the RedisPatchSchedule. /// The cancellation token to use. - public virtual NullableResponse GetIfExists(DefaultName @default, CancellationToken cancellationToken = default) + public virtual NullableResponse GetIfExists(RedisPatchScheduleDefaultName @default, CancellationToken cancellationToken = default) { using var scope = _redisPatchScheduleClientDiagnostics.CreateScope("RedisPatchScheduleCollection.GetIfExists"); scope.Start(); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.Serialization.cs index 944c7e61b01a..6bd8850dea3d 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.Serialization.cs @@ -80,7 +80,7 @@ internal static RedisPatchScheduleData DeserializeRedisPatchScheduleData(JsonEle string name = default; ResourceType type = default; SystemData systemData = default; - IList scheduleEntries = default; + IList scheduleEntries = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -125,10 +125,10 @@ internal static RedisPatchScheduleData DeserializeRedisPatchScheduleData(JsonEle { if (property0.NameEquals("scheduleEntries"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(ScheduleEntry.DeserializeScheduleEntry(item, options)); + array.Add(RedisPatchScheduleSetting.DeserializeRedisPatchScheduleSetting(item, options)); } scheduleEntries = array; continue; diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.cs index 406eb492c9f6..c6c4f4b60d77 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.cs @@ -55,7 +55,7 @@ public partial class RedisPatchScheduleData : ResourceData /// Initializes a new instance of . /// List of patch schedules for a Redis cache. /// is null. - public RedisPatchScheduleData(IEnumerable scheduleEntries) + public RedisPatchScheduleData(IEnumerable scheduleEntries) { Argument.AssertNotNull(scheduleEntries, nameof(scheduleEntries)); @@ -70,7 +70,7 @@ public RedisPatchScheduleData(IEnumerable scheduleEntries) /// List of patch schedules for a Redis cache. /// The geo-location where the resource lives. /// Keeps track of any properties unknown to the library. - internal RedisPatchScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList scheduleEntries, string location, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal RedisPatchScheduleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList scheduleEntries, string location, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ScheduleEntries = scheduleEntries; Location = location; @@ -83,7 +83,7 @@ internal RedisPatchScheduleData() } /// List of patch schedules for a Redis cache. - public IList ScheduleEntries { get; } + public IList ScheduleEntries { get; } /// The geo-location where the resource lives. public string Location { get; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleResource.cs index 41f0786a2d65..f43d9ccdfc09 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleResource.cs @@ -28,7 +28,7 @@ public partial class RedisPatchScheduleResource : ArmResource /// The resourceGroupName. /// The name. /// The default. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, DefaultName @default) + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName @default) { var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Cache/redis/{name}/patchSchedules/{@default}"; return new ResourceIdentifier(resourceId); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.Serialization.cs index ef9baefab588..1565dac36058 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.Serialization.cs @@ -46,15 +46,15 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("privateEndpoint"u8); ((IJsonModel)PrivateEndpoint).Write(writer, options); } - if (Optional.IsDefined(PrivateLinkServiceConnectionState)) + if (Optional.IsDefined(RedisPrivateLinkServiceConnectionState)) { writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(PrivateLinkServiceConnectionState, options); + writer.WriteObjectValue(RedisPrivateLinkServiceConnectionState, options); } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + if (options.Format != "W" && Optional.IsDefined(RedisProvisioningState)) { writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); + writer.WriteStringValue(RedisProvisioningState.Value.ToString()); } writer.WriteEndObject(); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.cs index 429dd7c92468..2cbabe67becd 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.cs @@ -63,14 +63,14 @@ public RedisPrivateEndpointConnectionData() /// The resourceType. /// The systemData. /// The private endpoint resource. - /// A collection of information about the state of the connection between service consumer and provider. - /// The provisioning state of the private endpoint connection resource. + /// A collection of information about the state of the connection between service consumer and provider. + /// The provisioning state of the private endpoint connection resource. /// Keeps track of any properties unknown to the library. - internal RedisPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubResource privateEndpoint, RedisPrivateLinkServiceConnectionState privateLinkServiceConnectionState, RedisPrivateEndpointConnectionProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal RedisPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubResource privateEndpoint, RedisPrivateLinkServiceConnectionState redisPrivateLinkServiceConnectionState, RedisPrivateEndpointConnectionProvisioningState? redisProvisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { PrivateEndpoint = privateEndpoint; - PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; - ProvisioningState = provisioningState; + RedisPrivateLinkServiceConnectionState = redisPrivateLinkServiceConnectionState; + RedisProvisioningState = redisProvisioningState; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -83,8 +83,8 @@ public ResourceIdentifier PrivateEndpointId } /// A collection of information about the state of the connection between service consumer and provider. - public RedisPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } + public RedisPrivateLinkServiceConnectionState RedisPrivateLinkServiceConnectionState { get; set; } /// The provisioning state of the private endpoint connection resource. - public RedisPrivateEndpointConnectionProvisioningState? ProvisioningState { get; } + public RedisPrivateEndpointConnectionProvisioningState? RedisProvisioningState { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs index 31e376b49be5..c79817da3356 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs @@ -191,7 +191,7 @@ public virtual RedisPatchScheduleCollection GetRedisPatchSchedules() /// The name of the RedisPatchSchedule. /// The cancellation token to use. [ForwardsClientCalls] - public virtual async Task> GetRedisPatchScheduleAsync(DefaultName @default, CancellationToken cancellationToken = default) + public virtual async Task> GetRedisPatchScheduleAsync(RedisPatchScheduleDefaultName @default, CancellationToken cancellationToken = default) { return await GetRedisPatchSchedules().GetAsync(@default, cancellationToken).ConfigureAwait(false); } @@ -220,7 +220,7 @@ public virtual async Task> GetRedisPatchSch /// The name of the RedisPatchSchedule. /// The cancellation token to use. [ForwardsClientCalls] - public virtual Response GetRedisPatchSchedule(DefaultName @default, CancellationToken cancellationToken = default) + public virtual Response GetRedisPatchSchedule(RedisPatchScheduleDefaultName @default, CancellationToken cancellationToken = default) { return GetRedisPatchSchedules().Get(@default, cancellationToken); } @@ -690,7 +690,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// Parameters supplied to the Update Redis operation. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, RedisResourcePatch patch, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, RedisPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); @@ -736,7 +736,7 @@ public virtual async Task> UpdateAsync(WaitUntil wai /// Parameters supplied to the Update Redis operation. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, RedisResourcePatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, RedisPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); @@ -780,12 +780,12 @@ public virtual ArmOperation Update(WaitUntil waitUntil, RedisReso /// /// how many minutes in past to look for upgrade notifications. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable ListUpgradeNotificationsAsync(double history, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable ListUpgradeNotificationsAsync(double history, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _redisResourceRestClient.CreateListUpgradeNotificationsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisResourceRestClient.CreateListUpgradeNotificationsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => UpgradeNotification.DeserializeUpgradeNotification(e), _redisResourceClientDiagnostics, Pipeline, "RedisResource.ListUpgradeNotifications", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => RedisUpgradeNotification.DeserializeRedisUpgradeNotification(e), _redisResourceClientDiagnostics, Pipeline, "RedisResource.ListUpgradeNotifications", "value", "nextLink", cancellationToken); } /// @@ -811,12 +811,12 @@ public virtual AsyncPageable ListUpgradeNotificationsAsync( /// /// how many minutes in past to look for upgrade notifications. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable ListUpgradeNotifications(double history, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable ListUpgradeNotifications(double history, CancellationToken cancellationToken = default) { HttpMessage FirstPageRequest(int? pageSizeHint) => _redisResourceRestClient.CreateListUpgradeNotificationsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisResourceRestClient.CreateListUpgradeNotificationsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => UpgradeNotification.DeserializeUpgradeNotification(e), _redisResourceClientDiagnostics, Pipeline, "RedisResource.ListUpgradeNotifications", "value", "nextLink", cancellationToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => RedisUpgradeNotification.DeserializeRedisUpgradeNotification(e), _redisResourceClientDiagnostics, Pipeline, "RedisResource.ListUpgradeNotifications", "value", "nextLink", cancellationToken); } /// @@ -1003,7 +1003,7 @@ public virtual Response RegenerateKey(RedisRegenerateKeyContent /// Specifies which Redis node(s) to reboot. /// The cancellation token to use. /// is null. - public virtual async Task> ForceRebootAsync(RedisRebootContent content, CancellationToken cancellationToken = default) + public virtual async Task> ForceRebootAsync(RedisRebootContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); @@ -1045,7 +1045,7 @@ public virtual async Task> ForceRebootAsync(R /// Specifies which Redis node(s) to reboot. /// The cancellation token to use. /// is null. - public virtual Response ForceReboot(RedisRebootContent content, CancellationToken cancellationToken = default) + public virtual Response ForceReboot(RedisRebootContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); @@ -1436,7 +1436,7 @@ public virtual async Task> AddTagAsync(string key, strin else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new RedisResourcePatch(); + var patch = new RedisPatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -1498,7 +1498,7 @@ public virtual Response AddTag(string key, string value, Cancella else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new RedisResourcePatch(); + var patch = new RedisPatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -1559,7 +1559,7 @@ public virtual async Task> SetTagsAsync(IDictionary SetTags(IDictionary tags, else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new RedisResourcePatch(); + var patch = new RedisPatch(); patch.Tags.ReplaceWith(tags); var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); return Response.FromValue(result.Value, result.GetRawResponse()); @@ -1672,7 +1672,7 @@ public virtual async Task> RemoveTagAsync(string key, Ca else { var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - var patch = new RedisResourcePatch(); + var patch = new RedisPatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); @@ -1732,7 +1732,7 @@ public virtual Response RemoveTag(string key, CancellationToken c else { var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new RedisResourcePatch(); + var patch = new RedisPatch(); foreach (var tag in current.Tags) { patch.Tags.Add(tag); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.Serialization.cs index c9c9e75b0e27..a748c41ca856 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.Serialization.cs @@ -155,7 +155,7 @@ internal static RedisResourceData DeserializeRedisResourceData(JsonElement eleme string name = default; ResourceType type = default; SystemData systemData = default; - ProvisioningState? provisioningState = default; + RedisProvisioningState? provisioningState = default; string hostName = default; int? port = default; int? sslPort = default; @@ -248,7 +248,7 @@ internal static RedisResourceData DeserializeRedisResourceData(JsonElement eleme { continue; } - provisioningState = new ProvisioningState(property0.Value.GetString()); + provisioningState = new RedisProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("hostName"u8)) diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.cs index 2b8e32c35db0..292ea6364121 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.cs @@ -82,7 +82,7 @@ internal RedisResourceData(AzureLocation location) /// Resource tags. /// The geo-location where the resource lives. /// Keeps track of any properties unknown to the library. - internal RedisResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ProvisioningState? provisioningState, string hostName, int? port, int? sslPort, RedisAccessKeys accessKeys, IReadOnlyList linkedServers, IReadOnlyList instances, IReadOnlyList privateEndpointConnections, IReadOnlyList zones, ManagedServiceIdentity identity, IReadOnlyDictionary tags, AzureLocation location, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal RedisResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, RedisProvisioningState? provisioningState, string hostName, int? port, int? sslPort, RedisAccessKeys accessKeys, IReadOnlyList linkedServers, IReadOnlyList instances, IReadOnlyList privateEndpointConnections, IReadOnlyList zones, ManagedServiceIdentity identity, IReadOnlyDictionary tags, AzureLocation location, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; HostName = hostName; @@ -105,7 +105,7 @@ internal RedisResourceData() } /// Redis instance provisioning status. - public ProvisioningState? ProvisioningState { get; } + public RedisProvisioningState? ProvisioningState { get; } /// Redis host name. public string HostName { get; } /// Redis non-SSL port. diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AsyncOperationStatusOperationGroupRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AsyncOperationStatusOperationGroupRestOperations.cs index 2ccdf9a70ced..f112123b6d4c 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AsyncOperationStatusOperationGroupRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/AsyncOperationStatusOperationGroupRestOperations.cs @@ -77,7 +77,7 @@ internal HttpMessage CreateGetRequest(string location, string operationId, strin /// 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 location, string operationId, string subscriptionId, CancellationToken cancellationToken = default) + public async Task> GetAsync(string location, string operationId, string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(location, nameof(location)); Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); @@ -89,9 +89,9 @@ public async Task> GetAsync(string location, string op { case 200: { - OperationStatus value = default; + RedisOperationStatus value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OperationStatus.DeserializeOperationStatus(document.RootElement); + value = RedisOperationStatus.DeserializeRedisOperationStatus(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -106,7 +106,7 @@ public async Task> GetAsync(string location, string op /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Get(string location, string operationId, string subscriptionId, CancellationToken cancellationToken = default) + public Response Get(string location, string operationId, string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(location, nameof(location)); Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); @@ -118,9 +118,9 @@ public Response Get(string location, string operationId, string { case 200: { - OperationStatus value = default; + RedisOperationStatus value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OperationStatus.DeserializeOperationStatus(document.RootElement); + value = RedisOperationStatus.DeserializeRedisOperationStatus(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisOperationGroupRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisOperationGroupRestOperations.cs index eb5b7d825e69..cd82e30309cb 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisOperationGroupRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisOperationGroupRestOperations.cs @@ -35,7 +35,7 @@ public RedisOperationGroupRestOperations(HttpPipeline pipeline, string applicati _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateCheckNameAvailabilityRequestUri(string subscriptionId, CheckNameAvailabilityContent content) + internal RequestUriBuilder CreateCheckNameAvailabilityRequestUri(string subscriptionId, RedisNameAvailabilityContent content) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -46,7 +46,7 @@ internal RequestUriBuilder CreateCheckNameAvailabilityRequestUri(string subscrip return uri; } - internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, CheckNameAvailabilityContent content) + internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, RedisNameAvailabilityContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -72,7 +72,7 @@ internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, C /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task CheckNameAvailabilityAsync(string subscriptionId, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + public async Task CheckNameAvailabilityAsync(string subscriptionId, RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNull(content, nameof(content)); @@ -94,7 +94,7 @@ public async Task CheckNameAvailabilityAsync(string subscriptionId, Ch /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. - public Response CheckNameAvailability(string subscriptionId, CheckNameAvailabilityContent content, CancellationToken cancellationToken = default) + public Response CheckNameAvailability(string subscriptionId, RedisNameAvailabilityContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNull(content, nameof(content)); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisPatchSchedulesRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisPatchSchedulesRestOperations.cs index 1c5574e7f7a4..e82c0107b149 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisPatchSchedulesRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisPatchSchedulesRestOperations.cs @@ -36,7 +36,7 @@ public RedisPatchSchedulesRestOperations(HttpPipeline pipeline, string applicati _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string name, DefaultName @default) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName @default) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -52,7 +52,7 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name, DefaultName @default) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName @default) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -82,7 +82,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string name, DefaultName @default, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName @default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -114,7 +114,7 @@ public async Task> GetAsync(string subscription /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string name, DefaultName @default, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName @default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -138,7 +138,7 @@ public Response Get(string subscriptionId, string resour } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, DefaultName @default, RedisPatchScheduleData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName @default, RedisPatchScheduleData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -154,7 +154,7 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string name, DefaultName @default, RedisPatchScheduleData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName @default, RedisPatchScheduleData data) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -189,7 +189,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string name, DefaultName @default, RedisPatchScheduleData data, CancellationToken cancellationToken = default) + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName @default, RedisPatchScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -222,7 +222,7 @@ public async Task> CreateOrUpdateAsync(string s /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string name, DefaultName @default, RedisPatchScheduleData data, CancellationToken cancellationToken = default) + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName @default, RedisPatchScheduleData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -246,7 +246,7 @@ public Response CreateOrUpdate(string subscriptionId, st } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string name, DefaultName @default) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName @default) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -262,7 +262,7 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string name, DefaultName @default) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName @default) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -291,7 +291,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string name, DefaultName @default, CancellationToken cancellationToken = default) + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName @default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -317,7 +317,7 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Delete(string subscriptionId, string resourceGroupName, string name, DefaultName @default, CancellationToken cancellationToken = default) + public Response Delete(string subscriptionId, string resourceGroupName, string name, RedisPatchScheduleDefaultName @default, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisResourcesRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisResourcesRestOperations.cs index 4bf704c13c02..e1b4db129bc7 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisResourcesRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisResourcesRestOperations.cs @@ -224,7 +224,7 @@ public Response Create(string subscriptionId, string resourceGroupName, string n } } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, RedisResourcePatch patch) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string name, RedisPatch patch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -238,7 +238,7 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string name, RedisResourcePatch patch) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string name, RedisPatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -270,7 +270,7 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string name, RedisResourcePatch patch, CancellationToken cancellationToken = default) + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string name, RedisPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -297,7 +297,7 @@ public async Task UpdateAsync(string subscriptionId, string resourceGr /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string name, RedisResourcePatch patch, CancellationToken cancellationToken = default) + public Response Update(string subscriptionId, string resourceGroupName, string name, RedisPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -611,7 +611,7 @@ internal HttpMessage CreateListUpgradeNotificationsRequest(string subscriptionId /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ListUpgradeNotificationsAsync(string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) + public async Task> ListUpgradeNotificationsAsync(string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -623,9 +623,9 @@ public async Task> ListUpgradeNotificationsAs { case 200: { - NotificationListResponse value = default; + RedisUpgradeNotificationListResponse value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NotificationListResponse.DeserializeNotificationListResponse(document.RootElement); + value = RedisUpgradeNotificationListResponse.DeserializeRedisUpgradeNotificationListResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -641,7 +641,7 @@ public async Task> ListUpgradeNotificationsAs /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ListUpgradeNotifications(string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) + public Response ListUpgradeNotifications(string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -653,9 +653,9 @@ public Response ListUpgradeNotifications(string subscr { case 200: { - NotificationListResponse value = default; + RedisUpgradeNotificationListResponse value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NotificationListResponse.DeserializeNotificationListResponse(document.RootElement); + value = RedisUpgradeNotificationListResponse.DeserializeRedisUpgradeNotificationListResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -907,7 +907,7 @@ internal HttpMessage CreateForceRebootRequest(string subscriptionId, string reso /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ForceRebootAsync(string subscriptionId, string resourceGroupName, string name, RedisRebootContent content, CancellationToken cancellationToken = default) + public async Task> ForceRebootAsync(string subscriptionId, string resourceGroupName, string name, RedisRebootContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -920,9 +920,9 @@ public async Task> ForceRebootAsync(string su { case 200: { - RedisForceRebootResponse value = default; + RedisForceRebootResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisForceRebootResponse.DeserializeRedisForceRebootResponse(document.RootElement); + value = RedisForceRebootResult.DeserializeRedisForceRebootResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -938,7 +938,7 @@ public async Task> ForceRebootAsync(string su /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ForceReboot(string subscriptionId, string resourceGroupName, string name, RedisRebootContent content, CancellationToken cancellationToken = default) + public Response ForceReboot(string subscriptionId, string resourceGroupName, string name, RedisRebootContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -951,9 +951,9 @@ public Response ForceReboot(string subscriptionId, str { case 200: { - RedisForceRebootResponse value = default; + RedisForceRebootResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisForceRebootResponse.DeserializeRedisForceRebootResponse(document.RootElement); + value = RedisForceRebootResult.DeserializeRedisForceRebootResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -1518,7 +1518,7 @@ internal HttpMessage CreateListUpgradeNotificationsNextPageRequest(string nextLi /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> ListUpgradeNotificationsNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) + public async Task> ListUpgradeNotificationsNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -1531,9 +1531,9 @@ public async Task> ListUpgradeNotificationsNe { case 200: { - NotificationListResponse value = default; + RedisUpgradeNotificationListResponse value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = NotificationListResponse.DeserializeNotificationListResponse(document.RootElement); + value = RedisUpgradeNotificationListResponse.DeserializeRedisUpgradeNotificationListResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -1550,7 +1550,7 @@ public async Task> ListUpgradeNotificationsNe /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ListUpgradeNotificationsNextPage(string nextLink, string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) + public Response ListUpgradeNotificationsNextPage(string nextLink, string subscriptionId, string resourceGroupName, string name, double history, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -1563,9 +1563,9 @@ public Response ListUpgradeNotificationsNextPage(strin { case 200: { - NotificationListResponse value = default; + RedisUpgradeNotificationListResponse value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = NotificationListResponse.DeserializeNotificationListResponse(document.RootElement); + value = RedisUpgradeNotificationListResponse.DeserializeRedisUpgradeNotificationListResponse(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/redis/Azure.ResourceManager.Redis/tsp-location.yaml b/sdk/redis/Azure.ResourceManager.Redis/tsp-location.yaml index 0cbf25c4778e..d22247904107 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/tsp-location.yaml +++ b/sdk/redis/Azure.ResourceManager.Redis/tsp-location.yaml @@ -1,3 +1,3 @@ directory: specification/redis/Cache.Management -commit: 89fd8c33eae90dad136c55a67491586db1445f41 +commit: 8aba41a76f3278396f07647ace4af85e4c461f80 repo: Azure/azure-rest-api-specs \ No newline at end of file From acf109ff9c561a69a94fc169ea0a210ee6a7e7ac Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Wed, 27 Aug 2025 13:33:35 +0800 Subject: [PATCH 3/4] regen --- .../api/Azure.ResourceManager.Redis.net8.0.cs | 224 +++++---- ...re.ResourceManager.Redis.netstandard2.0.cs | 224 +++++---- .../Models/RedisCreateOrUpdateContent.cs | 47 ++ .../src/Customization/RedisResource.cs | 17 +- .../src/Generated/ArmRedisModelFactory.cs | 82 ++-- .../MockableRedisResourceGroupResource.cs | 12 +- .../MockableRedisSubscriptionResource.cs | 20 +- .../Extensions/MockableRedisTenantResource.cs | 95 ---- .../Generated/Extensions/RedisExtensions.cs | 87 +--- .../Internal/BicepSerializationHelpers.cs | 58 +++ .../Generated/Internal/WirePathAttribute.cs | 27 ++ ...ationSource.cs => RedisOperationSource.cs} | 8 +- .../AzureResourceManagerRedisContext.cs | 13 +- .../Models/ExportRdbContent.Serialization.cs | 38 +- .../src/Generated/Models/ExportRdbContent.cs | 19 +- .../Models/ImportRdbContent.Serialization.cs | 38 +- .../src/Generated/Models/ImportRdbContent.cs | 18 +- .../Models/Operation.Serialization.cs | 144 ------ .../src/Generated/Models/Operation.cs | 69 --- .../Models/OperationDisplay.Serialization.cs | 162 ------- .../src/Generated/Models/OperationDisplay.cs | 77 ---- .../OperationListResult.Serialization.cs | 147 ------ .../Generated/Models/OperationListResult.cs | 80 ---- .../OperationStatusResult.Serialization.cs | 172 +++++++ .../Generated/Models/OperationStatusResult.cs | 8 + .../Models/RedisAccessKeys.Serialization.cs | 64 +++ .../src/Generated/Models/RedisAccessKeys.cs | 2 + ...ccessPolicyAssignmentList.Serialization.cs | 57 +++ .../RedisCacheAccessPolicyAssignmentList.cs | 2 + ...edisCacheAccessPolicyList.Serialization.cs | 57 +++ .../Models/RedisCacheAccessPolicyList.cs | 2 + .../RedisCommonConfiguration.Serialization.cs | 433 ++++++++++++++++++ .../Models/RedisCommonConfiguration.cs | 20 + ...disCreateOrUpdateContent.Serialization.cs} | 38 +- ...ntent.cs => RedisCreateOrUpdateContent.cs} | 21 +- ...disFirewallRuleListResult.Serialization.cs | 57 +++ .../Models/RedisFirewallRuleListResult.cs | 2 + .../RedisForceRebootResult.Serialization.cs | 41 ++ .../Models/RedisForceRebootResult.cs | 1 + .../RedisInstanceDetails.Serialization.cs | 118 +++++ .../Generated/Models/RedisInstanceDetails.cs | 6 + ...dServerWithPropertiesList.Serialization.cs | 57 +++ .../RedisLinkedServerWithPropertiesList.cs | 2 + ...ServerWithPropertyCreateOrUpdateContent.cs | 5 + .../Models/RedisListResult.Serialization.cs | 63 ++- .../src/Generated/Models/RedisListResult.cs | 8 +- .../Models/RedisNameAvailabilityContent.cs | 2 + .../RedisOperationStatus.Serialization.cs | 201 ++++++++ .../Generated/Models/RedisOperationStatus.cs | 1 + .../src/Generated/Models/RedisPatch.cs | 3 + ...isPatchScheduleListResult.Serialization.cs | 57 +++ .../Models/RedisPatchScheduleListResult.cs | 2 + ...RedisPatchScheduleSetting.Serialization.cs | 58 +++ .../Models/RedisPatchScheduleSetting.cs | 3 + ...pointConnectionListResult.Serialization.cs | 57 +++ ...edisPrivateEndpointConnectionListResult.cs | 2 + ...RedisPrivateLinkResource.Serialization.cs} | 123 ++++- ...rceData.cs => RedisPrivateLinkResource.cs} | 11 +- ...ateLinkResourceListResult.Serialization.cs | 63 ++- .../RedisPrivateLinkResourceListResult.cs | 8 +- ...ateLinkResourceProperties.Serialization.cs | 114 +++++ .../RedisPrivateLinkResourceProperties.cs | 3 + ...inkServiceConnectionState.Serialization.cs | 79 ++++ .../RedisPrivateLinkServiceConnectionState.cs | 3 + .../Models/RedisPublicNetworkAccess.cs | 51 +++ .../Generated/Models/RedisRebootContent.cs | 3 + .../Models/RedisRegenerateKeyContent.cs | 1 + .../Models/RedisSku.Serialization.cs | 54 +++ .../src/Generated/Models/RedisSku.cs | 3 + .../RedisUpgradeNotification.Serialization.cs | 95 ++++ .../Models/RedisUpgradeNotification.cs | 3 + ...eNotificationListResponse.Serialization.cs | 57 +++ .../RedisUpgradeNotificationListResponse.cs | 2 + .../src/Generated/Models/UpdateChannel.cs | 51 +++ .../Generated/Models/ZonalAllocationPolicy.cs | 54 +++ ...ccessPolicyAssignmentData.Serialization.cs | 149 ++++++ .../RedisCacheAccessPolicyAssignmentData.cs | 4 + ...edisCacheAccessPolicyData.Serialization.cs | 126 +++++ .../Generated/RedisCacheAccessPolicyData.cs | 3 + ...sourceCollection.cs => RedisCollection.cs} | 74 +-- ...lization.cs => RedisData.Serialization.cs} | 364 ++++++++++++++- .../{RedisResourceData.cs => RedisData.cs} | 28 +- .../RedisFirewallRuleData.Serialization.cs | 119 +++++ .../src/Generated/RedisFirewallRuleData.cs | 2 + ...kedServerWithPropertyData.Serialization.cs | 96 ++++ .../RedisLinkedServerWithPropertyData.cs | 1 + .../RedisPatchScheduleData.Serialization.cs | 120 +++++ .../src/Generated/RedisPatchScheduleData.cs | 2 + ...ateEndpointConnectionData.Serialization.cs | 123 +++++ .../RedisPrivateEndpointConnectionData.cs | 3 + .../Generated/RedisResource.Serialization.cs | 16 +- .../src/Generated/RedisResource.cs | 188 ++++---- .../OperationsRestOperations.cs | 173 ------- .../RedisResourcesRestOperations.cs | 40 +- ...RedisLinkedServerWithPropertyCollection.cs | 20 +- ...edisPrivateEndpointConnectionCollection.cs | 20 +- .../Sample_TenantResourceExtensions.cs | 43 -- 97 files changed, 4131 insertions(+), 1689 deletions(-) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisCreateOrUpdateContent.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisTenantResource.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/BicepSerializationHelpers.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/WirePathAttribute.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/{RedisResourceOperationSource.cs => RedisOperationSource.cs} (65%) delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.Serialization.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.Serialization.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.Serialization.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisResourceCreateOrUpdateContent.Serialization.cs => RedisCreateOrUpdateContent.Serialization.cs} (80%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisResourceCreateOrUpdateContent.cs => RedisCreateOrUpdateContent.cs} (86%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisPrivateLinkResourceData.Serialization.cs => RedisPrivateLinkResource.Serialization.cs} (50%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/{RedisPrivateLinkResourceData.cs => RedisPrivateLinkResource.cs} (83%) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPublicNetworkAccess.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/UpdateChannel.cs create mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ZonalAllocationPolicy.cs rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/{RedisResourceCollection.cs => RedisCollection.cs} (81%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/{RedisResourceData.Serialization.cs => RedisData.Serialization.cs} (52%) rename sdk/redis/Azure.ResourceManager.Redis/src/Generated/{RedisResourceData.cs => RedisData.cs} (81%) delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/OperationsRestOperations.cs delete mode 100644 sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_TenantResourceExtensions.cs diff --git a/sdk/redis/Azure.ResourceManager.Redis/api/Azure.ResourceManager.Redis.net8.0.cs b/sdk/redis/Azure.ResourceManager.Redis/api/Azure.ResourceManager.Redis.net8.0.cs index f937c27ac9ce..eb7c5a22de53 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/api/Azure.ResourceManager.Redis.net8.0.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/api/Azure.ResourceManager.Redis.net8.0.cs @@ -78,7 +78,7 @@ public partial class RedisCacheAccessPolicyData : Azure.ResourceManager.Models.R 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 Azure.ResourceManager.Redis.Models.AccessPolicyType? Type { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.RedisCacheAccessPolicyData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -122,34 +122,21 @@ protected RedisCollection() { } System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } } - public partial class RedisData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class RedisData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public RedisData(Azure.Core.AzureLocation location, Azure.ResourceManager.Redis.Models.RedisSku sku) { } + internal RedisData() { } public Azure.ResourceManager.Redis.Models.RedisAccessKeys AccessKeys { get { throw null; } } - public bool? EnableNonSslPort { get { throw null; } set { } } public string HostName { get { throw null; } } - public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } } public System.Collections.Generic.IReadOnlyList Instances { get { throw null; } } - public bool? IsAccessKeyAuthenticationDisabled { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList LinkedServers { get { throw null; } } - public Azure.ResourceManager.Redis.Models.RedisTlsVersion? MinimumTlsVersion { get { throw null; } set { } } + public Azure.Core.AzureLocation Location { get { throw null; } } public int? Port { get { throw null; } } public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } public Azure.ResourceManager.Redis.Models.RedisProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } - public Azure.ResourceManager.Redis.Models.RedisCommonConfiguration RedisConfiguration { get { throw null; } set { } } - public string RedisVersion { get { throw null; } set { } } - public int? ReplicasPerMaster { get { throw null; } set { } } - public int? ReplicasPerPrimary { get { throw null; } set { } } - public int? ShardCount { get { throw null; } set { } } - public Azure.ResourceManager.Redis.Models.RedisSku Sku { get { throw null; } set { } } public int? SslPort { get { throw null; } } - 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 Azure.ResourceManager.Redis.Models.ZonalAllocationPolicy? ZonalAllocationPolicy { get { throw null; } set { } } - public System.Collections.Generic.IList Zones { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Tags { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Zones { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.RedisData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -159,13 +146,11 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write } public static partial class RedisExtensions { - public static Azure.Response CheckRedisNameAvailability(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task CheckRedisNameAvailabilityAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response CheckNameAvailability(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task CheckNameAvailabilityAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response Get(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.Redis.RedisCollection GetAllRedis(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } - public static Azure.Pageable GetAllRedis(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.AsyncPageable GetAllRedisAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Response GetAsyncOperationStatus(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - 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 System.Threading.Tasks.Task> GetAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string 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; } @@ -175,6 +160,8 @@ public static partial class RedisExtensions public static Azure.ResourceManager.Redis.RedisPatchScheduleResource GetRedisPatchScheduleResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Redis.RedisPrivateEndpointConnectionResource GetRedisPrivateEndpointConnectionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Redis.RedisResource GetRedisResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Pageable ListBySubscription(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable ListBySubscriptionAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class RedisFirewallRuleCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -195,9 +182,9 @@ protected RedisFirewallRuleCollection() { } } public partial class RedisFirewallRuleData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public RedisFirewallRuleData(System.Net.IPAddress startIP, System.Net.IPAddress endIP) { } - public System.Net.IPAddress EndIP { get { throw null; } set { } } - public System.Net.IPAddress StartIP { get { throw null; } set { } } + public RedisFirewallRuleData(string startIP, string endIP) { } + public string EndIP { get { throw null; } set { } } + public string StartIP { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.RedisFirewallRuleData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -243,13 +230,8 @@ protected RedisLinkedServerWithPropertyCollection() { } } public partial class RedisLinkedServerWithPropertyData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public RedisLinkedServerWithPropertyData() { } - public string GeoReplicatedPrimaryHostName { get { throw null; } } - public Azure.Core.ResourceIdentifier LinkedRedisCacheId { get { throw null; } set { } } - public Azure.Core.AzureLocation? LinkedRedisCacheLocation { get { throw null; } set { } } - public string PrimaryHostName { get { throw null; } } + internal RedisLinkedServerWithPropertyData() { } public string ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Redis.Models.RedisLinkedServerRole? ServerRole { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.RedisLinkedServerWithPropertyData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -279,16 +261,16 @@ protected RedisLinkedServerWithPropertyResource() { } public partial class RedisPatchScheduleCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected RedisPatchScheduleCollection() { } - public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, Azure.ResourceManager.Redis.RedisPatchScheduleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, Azure.ResourceManager.Redis.RedisPatchScheduleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Exists(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, Azure.ResourceManager.Redis.RedisPatchScheduleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, Azure.ResourceManager.Redis.RedisPatchScheduleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, 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(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.NullableResponse GetIfExists(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, 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; } @@ -296,7 +278,7 @@ protected RedisPatchScheduleCollection() { } public partial class RedisPatchScheduleData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public RedisPatchScheduleData(System.Collections.Generic.IEnumerable scheduleEntries) { } - public Azure.Core.AzureLocation? Location { get { throw null; } } + public string Location { get { throw null; } } public System.Collections.Generic.IList ScheduleEntries { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.RedisPatchScheduleData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -311,7 +293,7 @@ public partial class RedisPatchScheduleResource : Azure.ResourceManager.ArmResou protected RedisPatchScheduleResource() { } public virtual Azure.ResourceManager.Redis.RedisPatchScheduleData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default) { 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; } @@ -386,16 +368,12 @@ 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.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; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetKeys(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - 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; } @@ -408,16 +386,20 @@ protected RedisResource() { } public virtual Azure.ResourceManager.Redis.RedisLinkedServerWithPropertyCollection GetRedisLinkedServerWithProperties() { throw null; } public virtual Azure.Response GetRedisLinkedServerWithProperty(string linkedServerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetRedisLinkedServerWithPropertyAsync(string linkedServerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetRedisPatchSchedule(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetRedisPatchScheduleAsync(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRedisPatchSchedule(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRedisPatchScheduleAsync(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Redis.RedisPatchScheduleCollection GetRedisPatchSchedules() { throw null; } public virtual Azure.Response GetRedisPrivateEndpointConnection(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetRedisPrivateEndpointConnectionAsync(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Redis.RedisPrivateEndpointConnectionCollection GetRedisPrivateEndpointConnections() { throw null; } - public virtual Azure.Pageable GetUpgradeNotifications(double history, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetUpgradeNotificationsAsync(double history, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.ArmOperation ImportData(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.Models.ImportRdbContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ImportDataAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.Models.ImportRdbContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListByRedisCache(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListByRedisCacheAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ListKeys(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ListKeysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListUpgradeNotifications(double history, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListUpgradeNotificationsAsync(double history, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RegenerateKey(Azure.ResourceManager.Redis.Models.RedisRegenerateKeyContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RegenerateKeyAsync(Azure.ResourceManager.Redis.Models.RedisRegenerateKeyContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -462,12 +444,12 @@ protected MockableRedisResourceGroupResource() { } public partial class MockableRedisSubscriptionResource : Azure.ResourceManager.ArmResource { protected MockableRedisSubscriptionResource() { } - public virtual Azure.Response CheckRedisNameAvailability(Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CheckRedisNameAvailabilityAsync(Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetAllRedis(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetAllRedisAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetAsyncOperationStatus(Azure.Core.AzureLocation location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsyncOperationStatusAsync(Azure.Core.AzureLocation location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckNameAvailability(Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CheckNameAvailabilityAsync(Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListBySubscription(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListBySubscriptionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.Redis.Models @@ -537,35 +519,23 @@ namespace Azure.ResourceManager.Redis.Models public static partial class ArmRedisModelFactory { public static Azure.ResourceManager.Redis.Models.ExportRdbContent ExportRdbContent(string format = null, string prefix = null, string container = null, string preferredDataArchiveAuthMethod = null, string storageSubscriptionId = null) { throw null; } + public static Azure.ResourceManager.Redis.Models.OperationStatusResult OperationStatusResult(string id = null, string name = null, string status = null, double? percentComplete = default(double?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable operations = null, Azure.ResponseError error = null) { throw null; } public static Azure.ResourceManager.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, 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, System.Collections.Generic.IDictionary additionalProperties) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.Redis.Models.RedisCommonConfiguration 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, System.Collections.Generic.IDictionary additionalProperties) { 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 notifyKeyspaceEvents = 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.Models.RedisCreateOrUpdateContent RedisCreateOrUpdateContent(System.Collections.Generic.IEnumerable zones, Azure.Core.AzureLocation location, System.Collections.Generic.IDictionary tags, Azure.ResourceManager.Models.ManagedServiceIdentity identity, Azure.ResourceManager.Redis.Models.RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, System.Collections.Generic.IDictionary tenantSettings, int? shardCount, Azure.ResourceManager.Redis.Models.RedisTlsVersion? minimumTlsVersion, Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? publicNetworkAccess, Azure.ResourceManager.Redis.Models.UpdateChannel? updateChannel, Azure.ResourceManager.Redis.Models.RedisSku sku, Azure.Core.ResourceIdentifier subnetId, System.Net.IPAddress staticIP) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.Redis.Models.RedisCreateOrUpdateContent RedisCreateOrUpdateContent(System.Collections.Generic.IEnumerable zones, Azure.Core.AzureLocation location, System.Collections.Generic.IDictionary tags, Azure.ResourceManager.Models.ManagedServiceIdentity identity, Azure.ResourceManager.Redis.Models.RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, System.Collections.Generic.IDictionary tenantSettings, int? shardCount, Azure.ResourceManager.Redis.Models.RedisTlsVersion? minimumTlsVersion, Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? publicNetworkAccess, Azure.ResourceManager.Redis.Models.UpdateChannel? updateChannel, bool? isAccessKeyAuthenticationDisabled, Azure.ResourceManager.Redis.Models.RedisSku sku, Azure.Core.ResourceIdentifier subnetId, System.Net.IPAddress staticIP) { throw null; } - public static Azure.ResourceManager.Redis.Models.RedisCreateOrUpdateContent RedisCreateOrUpdateContent(System.Collections.Generic.IEnumerable zones = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Collections.Generic.IDictionary tags = 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?), bool? isAccessKeyAuthenticationDisabled = default(bool?), Azure.ResourceManager.Redis.Models.ZonalAllocationPolicy? zonalAllocationPolicy = default(Azure.ResourceManager.Redis.Models.ZonalAllocationPolicy?), Azure.ResourceManager.Redis.Models.RedisSku sku = null, Azure.Core.ResourceIdentifier subnetId = null, System.Net.IPAddress staticIP = null) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.Redis.RedisData RedisData(Azure.Core.ResourceIdentifier id, string name, Azure.Core.ResourceType resourceType, Azure.ResourceManager.Models.SystemData systemData, System.Collections.Generic.IDictionary tags, Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable zones, Azure.ResourceManager.Models.ManagedServiceIdentity identity, Azure.ResourceManager.Redis.Models.RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, System.Collections.Generic.IDictionary tenantSettings, int? shardCount, Azure.ResourceManager.Redis.Models.RedisTlsVersion? minimumTlsVersion, Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? publicNetworkAccess, Azure.ResourceManager.Redis.Models.RedisSku sku, Azure.Core.ResourceIdentifier subnetId, System.Net.IPAddress staticIP, Azure.ResourceManager.Redis.Models.RedisProvisioningState? provisioningState, string hostName, int? port, int? sslPort, Azure.ResourceManager.Redis.Models.RedisAccessKeys accessKeys, System.Collections.Generic.IEnumerable linkedServers, System.Collections.Generic.IEnumerable instances, System.Collections.Generic.IEnumerable privateEndpointConnections) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.Redis.RedisData RedisData(Azure.Core.ResourceIdentifier id, string name, Azure.Core.ResourceType resourceType, Azure.ResourceManager.Models.SystemData systemData, System.Collections.Generic.IDictionary tags, Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable zones, Azure.ResourceManager.Models.ManagedServiceIdentity identity, Azure.ResourceManager.Redis.Models.RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, System.Collections.Generic.IDictionary tenantSettings, int? shardCount, Azure.ResourceManager.Redis.Models.RedisTlsVersion? minimumTlsVersion, Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? publicNetworkAccess, Azure.ResourceManager.Redis.Models.UpdateChannel? updateChannel, Azure.ResourceManager.Redis.Models.RedisSku sku, Azure.Core.ResourceIdentifier subnetId, System.Net.IPAddress staticIP, Azure.ResourceManager.Redis.Models.RedisProvisioningState? provisioningState, string hostName, int? port, int? sslPort, Azure.ResourceManager.Redis.Models.RedisAccessKeys accessKeys, System.Collections.Generic.IEnumerable linkedServers, System.Collections.Generic.IEnumerable instances, System.Collections.Generic.IEnumerable privateEndpointConnections) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.Redis.RedisData RedisData(Azure.Core.ResourceIdentifier id, string name, Azure.Core.ResourceType resourceType, Azure.ResourceManager.Models.SystemData systemData, System.Collections.Generic.IDictionary tags, Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable zones, Azure.ResourceManager.Models.ManagedServiceIdentity identity, Azure.ResourceManager.Redis.Models.RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, System.Collections.Generic.IDictionary tenantSettings, int? shardCount, Azure.ResourceManager.Redis.Models.RedisTlsVersion? minimumTlsVersion, Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? publicNetworkAccess, Azure.ResourceManager.Redis.Models.UpdateChannel? updateChannel, bool? isAccessKeyAuthenticationDisabled, Azure.ResourceManager.Redis.Models.RedisSku sku, Azure.Core.ResourceIdentifier subnetId, System.Net.IPAddress staticIP, Azure.ResourceManager.Redis.Models.RedisProvisioningState? provisioningState, string hostName, int? port, int? sslPort, Azure.ResourceManager.Redis.Models.RedisAccessKeys accessKeys, System.Collections.Generic.IEnumerable linkedServers, System.Collections.Generic.IEnumerable instances, System.Collections.Generic.IEnumerable privateEndpointConnections) { 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?), bool? isAccessKeyAuthenticationDisabled = default(bool?), Azure.ResourceManager.Redis.Models.ZonalAllocationPolicy? zonalAllocationPolicy = default(Azure.ResourceManager.Redis.Models.ZonalAllocationPolicy?), 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.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? type = default(Azure.ResourceManager.Redis.Models.AccessPolicyType?), string permissions = 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 notifyKeyspaceEvents = 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; } + public static Azure.ResourceManager.Redis.Models.RedisCreateOrUpdateContent RedisCreateOrUpdateContent(Azure.ResourceManager.Redis.Models.RedisSku sku = null, string subnetId = null, string staticIP = null, System.Collections.Generic.IEnumerable zones = null, string location = null, System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = 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, 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, System.Collections.Generic.IEnumerable zones = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, System.Collections.Generic.IReadOnlyDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation)) { 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, string startIP = null, string 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; } - public static Azure.ResourceManager.Redis.Models.RedisLinkedServerWithPropertyCreateOrUpdateContent RedisLinkedServerWithPropertyCreateOrUpdateContent(Azure.Core.ResourceIdentifier linkedRedisCacheId = null, Azure.Core.AzureLocation linkedRedisCacheLocation = default(Azure.Core.AzureLocation), Azure.ResourceManager.Redis.Models.RedisLinkedServerRole serverRole = Azure.ResourceManager.Redis.Models.RedisLinkedServerRole.Primary, string geoReplicatedPrimaryHostName = null, string primaryHostName = null) { throw null; } - public static Azure.ResourceManager.Redis.RedisLinkedServerWithPropertyData RedisLinkedServerWithPropertyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier linkedRedisCacheId = null, Azure.Core.AzureLocation? linkedRedisCacheLocation = default(Azure.Core.AzureLocation?), Azure.ResourceManager.Redis.Models.RedisLinkedServerRole? serverRole = default(Azure.ResourceManager.Redis.Models.RedisLinkedServerRole?), string geoReplicatedPrimaryHostName = null, string primaryHostName = null, string provisioningState = null) { throw null; } - public static Azure.ResourceManager.Redis.Models.RedisOperationStatus RedisOperationStatus(Azure.Core.ResourceIdentifier id = null, string name = null, string status = null, float? percentComplete = default(float?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable operations = null, Azure.ResponseError error = null, System.Collections.Generic.IReadOnlyDictionary properties = null) { throw null; } - public static Azure.ResourceManager.Redis.RedisPatchScheduleData RedisPatchScheduleData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IEnumerable scheduleEntries = null) { throw null; } + public static Azure.ResourceManager.Redis.Models.RedisLinkedServerWithPropertyCreateOrUpdateContent RedisLinkedServerWithPropertyCreateOrUpdateContent(string linkedRedisCacheId = null, string linkedRedisCacheLocation = null, Azure.ResourceManager.Redis.Models.RedisLinkedServerRole serverRole = Azure.ResourceManager.Redis.Models.RedisLinkedServerRole.Primary, string geoReplicatedPrimaryHostName = null, string primaryHostName = null) { throw null; } + public static Azure.ResourceManager.Redis.RedisLinkedServerWithPropertyData RedisLinkedServerWithPropertyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string provisioningState = null) { throw null; } + public static Azure.ResourceManager.Redis.Models.RedisOperationStatus RedisOperationStatus(string id = null, string name = null, string status = null, double? percentComplete = default(double?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable operations = null, Azure.ResponseError error = null, System.Collections.Generic.IReadOnlyDictionary properties = null) { throw null; } + public static Azure.ResourceManager.Redis.RedisPatchScheduleData RedisPatchScheduleData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IEnumerable scheduleEntries = null, string location = null) { throw null; } public static Azure.ResourceManager.Redis.RedisPrivateEndpointConnectionData RedisPrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier privateEndpointId = null, Azure.ResourceManager.Redis.Models.RedisPrivateLinkServiceConnectionState redisPrivateLinkServiceConnectionState = null, Azure.ResourceManager.Redis.Models.RedisPrivateEndpointConnectionProvisioningState? redisProvisioningState = default(Azure.ResourceManager.Redis.Models.RedisPrivateEndpointConnectionProvisioningState?)) { throw null; } - public static Azure.ResourceManager.Redis.Models.RedisPrivateLinkResource RedisPrivateLinkResource(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } + public static Azure.ResourceManager.Redis.Models.RedisPrivateLinkResource RedisPrivateLinkResource(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.RedisPrivateLinkResourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.Redis.Models.RedisPrivateLinkResourceProperties RedisPrivateLinkResourceProperties(string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } public static Azure.ResourceManager.Redis.Models.RedisUpgradeNotification RedisUpgradeNotification(string name = null, System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), System.Collections.Generic.IReadOnlyDictionary upsellNotification = null) { throw null; } } public partial class ExportRdbContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel @@ -597,6 +567,24 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class OperationStatusResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal OperationStatusResult() { } + public System.DateTimeOffset? EndOn { get { throw null; } } + public Azure.ResponseError Error { get { throw null; } } + public string Id { get { throw null; } } + public string Name { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Operations { get { throw null; } } + public double? PercentComplete { get { throw null; } } + public System.DateTimeOffset? StartOn { get { throw null; } } + public string Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Redis.Models.OperationStatusResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Redis.Models.OperationStatusResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class RedisAccessKeys : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal RedisAccessKeys() { } @@ -615,15 +603,15 @@ public RedisCommonConfiguration() { } public System.Collections.Generic.IDictionary AdditionalProperties { get { throw null; } } public string AofStorageConnectionString0 { get { throw null; } set { } } public string AofStorageConnectionString1 { get { throw null; } set { } } - public string AuthNotRequired { 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; } } - public string MaxFragmentationMemoryReserved { get { throw null; } set { } } - public string MaxMemoryDelta { get { throw null; } set { } } - public string MaxMemoryPolicy { get { throw null; } set { } } - public string MaxMemoryReserved { get { throw null; } set { } } + public string Maxclients { get { throw null; } } + public string MaxfragmentationmemoryReserved { get { throw null; } set { } } + public string MaxmemoryDelta { get { throw null; } set { } } + public string MaxmemoryPolicy { get { throw null; } set { } } + public string MaxmemoryReserved { get { throw null; } set { } } public string NotifyKeyspaceEvents { get { throw null; } set { } } public string PreferredDataArchiveAuthMethod { get { throw null; } } public string PreferredDataPersistenceAuthMethod { get { throw null; } set { } } @@ -641,11 +629,11 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } public partial class RedisCreateOrUpdateContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public RedisCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.Redis.Models.RedisSku sku) { } + public RedisCreateOrUpdateContent(Azure.ResourceManager.Redis.Models.RedisSku sku, string location) { } public bool? EnableNonSslPort { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public bool? IsAccessKeyAuthenticationDisabled { get { throw null; } set { } } - public Azure.Core.AzureLocation Location { get { throw null; } } + public string Location { get { throw null; } } public Azure.ResourceManager.Redis.Models.RedisTlsVersion? MinimumTlsVersion { get { throw null; } set { } } public Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } public Azure.ResourceManager.Redis.Models.RedisCommonConfiguration RedisConfiguration { get { throw null; } set { } } @@ -654,8 +642,8 @@ public RedisCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.Resou public int? ReplicasPerPrimary { get { throw null; } set { } } public int? ShardCount { get { throw null; } set { } } public Azure.ResourceManager.Redis.Models.RedisSku Sku { get { throw null; } } - public System.Net.IPAddress StaticIP { get { throw null; } set { } } - public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } + public string StaticIP { get { throw null; } set { } } + public string 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 { } } @@ -714,10 +702,10 @@ public enum RedisLinkedServerRole } public partial class RedisLinkedServerWithPropertyCreateOrUpdateContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public RedisLinkedServerWithPropertyCreateOrUpdateContent(Azure.Core.ResourceIdentifier linkedRedisCacheId, Azure.Core.AzureLocation linkedRedisCacheLocation, Azure.ResourceManager.Redis.Models.RedisLinkedServerRole serverRole) { } + public RedisLinkedServerWithPropertyCreateOrUpdateContent(string linkedRedisCacheId, string linkedRedisCacheLocation, Azure.ResourceManager.Redis.Models.RedisLinkedServerRole serverRole) { } public string GeoReplicatedPrimaryHostName { get { throw null; } } - public Azure.Core.ResourceIdentifier LinkedRedisCacheId { get { throw null; } } - public Azure.Core.AzureLocation LinkedRedisCacheLocation { get { throw null; } } + public string LinkedRedisCacheId { get { throw null; } } + public string LinkedRedisCacheLocation { get { throw null; } } public string PrimaryHostName { get { throw null; } } public Azure.ResourceManager.Redis.Models.RedisLinkedServerRole ServerRole { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -729,9 +717,9 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } public partial class RedisNameAvailabilityContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public RedisNameAvailabilityContent(string name, Azure.Core.ResourceType resourceType) { } + public RedisNameAvailabilityContent(string name, string type) { } public string Name { get { throw null; } } - public Azure.Core.ResourceType ResourceType { get { throw null; } } + public string Type { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -739,7 +727,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class RedisOperationStatus : Azure.ResourceManager.Models.OperationStatusResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class RedisOperationStatus : Azure.ResourceManager.Redis.Models.OperationStatusResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal RedisOperationStatus() { } public System.Collections.Generic.IReadOnlyDictionary Properties { get { throw null; } } @@ -753,21 +741,9 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public partial class RedisPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public RedisPatch() { } - public bool? EnableNonSslPort { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } - public bool? IsAccessKeyAuthenticationDisabled { get { throw null; } set { } } - public Azure.ResourceManager.Redis.Models.RedisTlsVersion? MinimumTlsVersion { get { throw null; } set { } } - public Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } - public Azure.ResourceManager.Redis.Models.RedisCommonConfiguration RedisConfiguration { get { throw null; } set { } } - public string RedisVersion { get { throw null; } set { } } - public int? ReplicasPerMaster { get { throw null; } set { } } - public int? ReplicasPerPrimary { get { throw null; } set { } } - public int? ShardCount { get { throw null; } set { } } 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 { } } - public Azure.ResourceManager.Redis.Models.ZonalAllocationPolicy? ZonalAllocationPolicy { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.Models.RedisPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -846,10 +822,8 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } public partial class RedisPrivateLinkResource : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public RedisPrivateLinkResource() { } - public string GroupId { get { throw null; } } - public System.Collections.Generic.IReadOnlyList RequiredMembers { get { throw null; } } - public System.Collections.Generic.IList RequiredZoneNames { get { throw null; } } + internal RedisPrivateLinkResource() { } + public Azure.ResourceManager.Redis.Models.RedisPrivateLinkResourceProperties Properties { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.Models.RedisPrivateLinkResource System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -857,6 +831,19 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class RedisPrivateLinkResourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal RedisPrivateLinkResourceProperties() { } + public string GroupId { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RequiredMembers { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RequiredZoneNames { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Redis.Models.RedisPrivateLinkResourceProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Redis.Models.RedisPrivateLinkResourceProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class RedisPrivateLinkServiceConnectionState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public RedisPrivateLinkServiceConnectionState() { } @@ -1024,6 +1011,9 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static Azure.ResourceManager.Redis.Models.RedisTlsVersion Tls1_0 { get { throw null; } } public static Azure.ResourceManager.Redis.Models.RedisTlsVersion Tls1_1 { get { throw null; } } public static Azure.ResourceManager.Redis.Models.RedisTlsVersion Tls1_2 { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.RedisTlsVersion _10 { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.RedisTlsVersion _11 { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.RedisTlsVersion _12 { get { throw null; } } public bool Equals(Azure.ResourceManager.Redis.Models.RedisTlsVersion other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } 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 f937c27ac9ce..eb7c5a22de53 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 @@ -78,7 +78,7 @@ public partial class RedisCacheAccessPolicyData : Azure.ResourceManager.Models.R 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 Azure.ResourceManager.Redis.Models.AccessPolicyType? Type { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.RedisCacheAccessPolicyData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -122,34 +122,21 @@ protected RedisCollection() { } System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } } - public partial class RedisData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class RedisData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public RedisData(Azure.Core.AzureLocation location, Azure.ResourceManager.Redis.Models.RedisSku sku) { } + internal RedisData() { } public Azure.ResourceManager.Redis.Models.RedisAccessKeys AccessKeys { get { throw null; } } - public bool? EnableNonSslPort { get { throw null; } set { } } public string HostName { get { throw null; } } - public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } } public System.Collections.Generic.IReadOnlyList Instances { get { throw null; } } - public bool? IsAccessKeyAuthenticationDisabled { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList LinkedServers { get { throw null; } } - public Azure.ResourceManager.Redis.Models.RedisTlsVersion? MinimumTlsVersion { get { throw null; } set { } } + public Azure.Core.AzureLocation Location { get { throw null; } } public int? Port { get { throw null; } } public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } public Azure.ResourceManager.Redis.Models.RedisProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } - public Azure.ResourceManager.Redis.Models.RedisCommonConfiguration RedisConfiguration { get { throw null; } set { } } - public string RedisVersion { get { throw null; } set { } } - public int? ReplicasPerMaster { get { throw null; } set { } } - public int? ReplicasPerPrimary { get { throw null; } set { } } - public int? ShardCount { get { throw null; } set { } } - public Azure.ResourceManager.Redis.Models.RedisSku Sku { get { throw null; } set { } } public int? SslPort { get { throw null; } } - 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 Azure.ResourceManager.Redis.Models.ZonalAllocationPolicy? ZonalAllocationPolicy { get { throw null; } set { } } - public System.Collections.Generic.IList Zones { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Tags { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Zones { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.RedisData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -159,13 +146,11 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write } public static partial class RedisExtensions { - public static Azure.Response CheckRedisNameAvailability(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static System.Threading.Tasks.Task CheckRedisNameAvailabilityAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response CheckNameAvailability(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task CheckNameAvailabilityAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response Get(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.Redis.RedisCollection GetAllRedis(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } - public static Azure.Pageable GetAllRedis(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.AsyncPageable GetAllRedisAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public static Azure.Response GetAsyncOperationStatus(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.Core.AzureLocation location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - 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 System.Threading.Tasks.Task> GetAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string 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; } @@ -175,6 +160,8 @@ public static partial class RedisExtensions public static Azure.ResourceManager.Redis.RedisPatchScheduleResource GetRedisPatchScheduleResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Redis.RedisPrivateEndpointConnectionResource GetRedisPrivateEndpointConnectionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Redis.RedisResource GetRedisResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Pageable ListBySubscription(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable ListBySubscriptionAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class RedisFirewallRuleCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -195,9 +182,9 @@ protected RedisFirewallRuleCollection() { } } public partial class RedisFirewallRuleData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public RedisFirewallRuleData(System.Net.IPAddress startIP, System.Net.IPAddress endIP) { } - public System.Net.IPAddress EndIP { get { throw null; } set { } } - public System.Net.IPAddress StartIP { get { throw null; } set { } } + public RedisFirewallRuleData(string startIP, string endIP) { } + public string EndIP { get { throw null; } set { } } + public string StartIP { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.RedisFirewallRuleData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -243,13 +230,8 @@ protected RedisLinkedServerWithPropertyCollection() { } } public partial class RedisLinkedServerWithPropertyData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public RedisLinkedServerWithPropertyData() { } - public string GeoReplicatedPrimaryHostName { get { throw null; } } - public Azure.Core.ResourceIdentifier LinkedRedisCacheId { get { throw null; } set { } } - public Azure.Core.AzureLocation? LinkedRedisCacheLocation { get { throw null; } set { } } - public string PrimaryHostName { get { throw null; } } + internal RedisLinkedServerWithPropertyData() { } public string ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Redis.Models.RedisLinkedServerRole? ServerRole { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.RedisLinkedServerWithPropertyData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -279,16 +261,16 @@ protected RedisLinkedServerWithPropertyResource() { } public partial class RedisPatchScheduleCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected RedisPatchScheduleCollection() { } - public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, Azure.ResourceManager.Redis.RedisPatchScheduleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, Azure.ResourceManager.Redis.RedisPatchScheduleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Exists(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> ExistsAsync(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response Get(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, Azure.ResourceManager.Redis.RedisPatchScheduleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, Azure.ResourceManager.Redis.RedisPatchScheduleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, 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(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.NullableResponse GetIfExists(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetIfExistsAsync(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, 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; } @@ -296,7 +278,7 @@ protected RedisPatchScheduleCollection() { } public partial class RedisPatchScheduleData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public RedisPatchScheduleData(System.Collections.Generic.IEnumerable scheduleEntries) { } - public Azure.Core.AzureLocation? Location { get { throw null; } } + public string Location { get { throw null; } } public System.Collections.Generic.IList ScheduleEntries { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.RedisPatchScheduleData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -311,7 +293,7 @@ public partial class RedisPatchScheduleResource : Azure.ResourceManager.ArmResou protected RedisPatchScheduleResource() { } public virtual Azure.ResourceManager.Redis.RedisPatchScheduleData Data { get { throw null; } } public virtual bool HasData { get { throw null; } } - public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default) { 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; } @@ -386,16 +368,12 @@ 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.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; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetKeys(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - 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; } @@ -408,16 +386,20 @@ protected RedisResource() { } public virtual Azure.ResourceManager.Redis.RedisLinkedServerWithPropertyCollection GetRedisLinkedServerWithProperties() { throw null; } public virtual Azure.Response GetRedisLinkedServerWithProperty(string linkedServerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetRedisLinkedServerWithPropertyAsync(string linkedServerName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetRedisPatchSchedule(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetRedisPatchScheduleAsync(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName defaultName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetRedisPatchSchedule(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetRedisPatchScheduleAsync(Azure.ResourceManager.Redis.Models.RedisPatchScheduleDefaultName @default, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Redis.RedisPatchScheduleCollection GetRedisPatchSchedules() { throw null; } public virtual Azure.Response GetRedisPrivateEndpointConnection(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetRedisPrivateEndpointConnectionAsync(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Redis.RedisPrivateEndpointConnectionCollection GetRedisPrivateEndpointConnections() { throw null; } - public virtual Azure.Pageable GetUpgradeNotifications(double history, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetUpgradeNotificationsAsync(double history, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.ArmOperation ImportData(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.Models.ImportRdbContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ImportDataAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Redis.Models.ImportRdbContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListByRedisCache(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListByRedisCacheAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response ListKeys(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ListKeysAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListUpgradeNotifications(double history, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListUpgradeNotificationsAsync(double history, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RegenerateKey(Azure.ResourceManager.Redis.Models.RedisRegenerateKeyContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RegenerateKeyAsync(Azure.ResourceManager.Redis.Models.RedisRegenerateKeyContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -462,12 +444,12 @@ protected MockableRedisResourceGroupResource() { } public partial class MockableRedisSubscriptionResource : Azure.ResourceManager.ArmResource { protected MockableRedisSubscriptionResource() { } - public virtual Azure.Response CheckRedisNameAvailability(Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task CheckRedisNameAvailabilityAsync(Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetAllRedis(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetAllRedisAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetAsyncOperationStatus(Azure.Core.AzureLocation location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetAsyncOperationStatusAsync(Azure.Core.AzureLocation location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckNameAvailability(Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CheckNameAvailabilityAsync(Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string location, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable ListBySubscription(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable ListBySubscriptionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.Redis.Models @@ -537,35 +519,23 @@ namespace Azure.ResourceManager.Redis.Models public static partial class ArmRedisModelFactory { public static Azure.ResourceManager.Redis.Models.ExportRdbContent ExportRdbContent(string format = null, string prefix = null, string container = null, string preferredDataArchiveAuthMethod = null, string storageSubscriptionId = null) { throw null; } + public static Azure.ResourceManager.Redis.Models.OperationStatusResult OperationStatusResult(string id = null, string name = null, string status = null, double? percentComplete = default(double?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable operations = null, Azure.ResponseError error = null) { throw null; } public static Azure.ResourceManager.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, 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, System.Collections.Generic.IDictionary additionalProperties) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.Redis.Models.RedisCommonConfiguration 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, System.Collections.Generic.IDictionary additionalProperties) { 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 notifyKeyspaceEvents = 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.Models.RedisCreateOrUpdateContent RedisCreateOrUpdateContent(System.Collections.Generic.IEnumerable zones, Azure.Core.AzureLocation location, System.Collections.Generic.IDictionary tags, Azure.ResourceManager.Models.ManagedServiceIdentity identity, Azure.ResourceManager.Redis.Models.RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, System.Collections.Generic.IDictionary tenantSettings, int? shardCount, Azure.ResourceManager.Redis.Models.RedisTlsVersion? minimumTlsVersion, Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? publicNetworkAccess, Azure.ResourceManager.Redis.Models.UpdateChannel? updateChannel, Azure.ResourceManager.Redis.Models.RedisSku sku, Azure.Core.ResourceIdentifier subnetId, System.Net.IPAddress staticIP) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.Redis.Models.RedisCreateOrUpdateContent RedisCreateOrUpdateContent(System.Collections.Generic.IEnumerable zones, Azure.Core.AzureLocation location, System.Collections.Generic.IDictionary tags, Azure.ResourceManager.Models.ManagedServiceIdentity identity, Azure.ResourceManager.Redis.Models.RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, System.Collections.Generic.IDictionary tenantSettings, int? shardCount, Azure.ResourceManager.Redis.Models.RedisTlsVersion? minimumTlsVersion, Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? publicNetworkAccess, Azure.ResourceManager.Redis.Models.UpdateChannel? updateChannel, bool? isAccessKeyAuthenticationDisabled, Azure.ResourceManager.Redis.Models.RedisSku sku, Azure.Core.ResourceIdentifier subnetId, System.Net.IPAddress staticIP) { throw null; } - public static Azure.ResourceManager.Redis.Models.RedisCreateOrUpdateContent RedisCreateOrUpdateContent(System.Collections.Generic.IEnumerable zones = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), System.Collections.Generic.IDictionary tags = 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?), bool? isAccessKeyAuthenticationDisabled = default(bool?), Azure.ResourceManager.Redis.Models.ZonalAllocationPolicy? zonalAllocationPolicy = default(Azure.ResourceManager.Redis.Models.ZonalAllocationPolicy?), Azure.ResourceManager.Redis.Models.RedisSku sku = null, Azure.Core.ResourceIdentifier subnetId = null, System.Net.IPAddress staticIP = null) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.Redis.RedisData RedisData(Azure.Core.ResourceIdentifier id, string name, Azure.Core.ResourceType resourceType, Azure.ResourceManager.Models.SystemData systemData, System.Collections.Generic.IDictionary tags, Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable zones, Azure.ResourceManager.Models.ManagedServiceIdentity identity, Azure.ResourceManager.Redis.Models.RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, System.Collections.Generic.IDictionary tenantSettings, int? shardCount, Azure.ResourceManager.Redis.Models.RedisTlsVersion? minimumTlsVersion, Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? publicNetworkAccess, Azure.ResourceManager.Redis.Models.RedisSku sku, Azure.Core.ResourceIdentifier subnetId, System.Net.IPAddress staticIP, Azure.ResourceManager.Redis.Models.RedisProvisioningState? provisioningState, string hostName, int? port, int? sslPort, Azure.ResourceManager.Redis.Models.RedisAccessKeys accessKeys, System.Collections.Generic.IEnumerable linkedServers, System.Collections.Generic.IEnumerable instances, System.Collections.Generic.IEnumerable privateEndpointConnections) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.Redis.RedisData RedisData(Azure.Core.ResourceIdentifier id, string name, Azure.Core.ResourceType resourceType, Azure.ResourceManager.Models.SystemData systemData, System.Collections.Generic.IDictionary tags, Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable zones, Azure.ResourceManager.Models.ManagedServiceIdentity identity, Azure.ResourceManager.Redis.Models.RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, System.Collections.Generic.IDictionary tenantSettings, int? shardCount, Azure.ResourceManager.Redis.Models.RedisTlsVersion? minimumTlsVersion, Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? publicNetworkAccess, Azure.ResourceManager.Redis.Models.UpdateChannel? updateChannel, Azure.ResourceManager.Redis.Models.RedisSku sku, Azure.Core.ResourceIdentifier subnetId, System.Net.IPAddress staticIP, Azure.ResourceManager.Redis.Models.RedisProvisioningState? provisioningState, string hostName, int? port, int? sslPort, Azure.ResourceManager.Redis.Models.RedisAccessKeys accessKeys, System.Collections.Generic.IEnumerable linkedServers, System.Collections.Generic.IEnumerable instances, System.Collections.Generic.IEnumerable privateEndpointConnections) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public static Azure.ResourceManager.Redis.RedisData RedisData(Azure.Core.ResourceIdentifier id, string name, Azure.Core.ResourceType resourceType, Azure.ResourceManager.Models.SystemData systemData, System.Collections.Generic.IDictionary tags, Azure.Core.AzureLocation location, System.Collections.Generic.IEnumerable zones, Azure.ResourceManager.Models.ManagedServiceIdentity identity, Azure.ResourceManager.Redis.Models.RedisCommonConfiguration redisConfiguration, string redisVersion, bool? enableNonSslPort, int? replicasPerMaster, int? replicasPerPrimary, System.Collections.Generic.IDictionary tenantSettings, int? shardCount, Azure.ResourceManager.Redis.Models.RedisTlsVersion? minimumTlsVersion, Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? publicNetworkAccess, Azure.ResourceManager.Redis.Models.UpdateChannel? updateChannel, bool? isAccessKeyAuthenticationDisabled, Azure.ResourceManager.Redis.Models.RedisSku sku, Azure.Core.ResourceIdentifier subnetId, System.Net.IPAddress staticIP, Azure.ResourceManager.Redis.Models.RedisProvisioningState? provisioningState, string hostName, int? port, int? sslPort, Azure.ResourceManager.Redis.Models.RedisAccessKeys accessKeys, System.Collections.Generic.IEnumerable linkedServers, System.Collections.Generic.IEnumerable instances, System.Collections.Generic.IEnumerable privateEndpointConnections) { 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?), bool? isAccessKeyAuthenticationDisabled = default(bool?), Azure.ResourceManager.Redis.Models.ZonalAllocationPolicy? zonalAllocationPolicy = default(Azure.ResourceManager.Redis.Models.ZonalAllocationPolicy?), 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.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? type = default(Azure.ResourceManager.Redis.Models.AccessPolicyType?), string permissions = 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 notifyKeyspaceEvents = 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; } + public static Azure.ResourceManager.Redis.Models.RedisCreateOrUpdateContent RedisCreateOrUpdateContent(Azure.ResourceManager.Redis.Models.RedisSku sku = null, string subnetId = null, string staticIP = null, System.Collections.Generic.IEnumerable zones = null, string location = null, System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = 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, 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, System.Collections.Generic.IEnumerable zones = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, System.Collections.Generic.IReadOnlyDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation)) { 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, string startIP = null, string 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; } - public static Azure.ResourceManager.Redis.Models.RedisLinkedServerWithPropertyCreateOrUpdateContent RedisLinkedServerWithPropertyCreateOrUpdateContent(Azure.Core.ResourceIdentifier linkedRedisCacheId = null, Azure.Core.AzureLocation linkedRedisCacheLocation = default(Azure.Core.AzureLocation), Azure.ResourceManager.Redis.Models.RedisLinkedServerRole serverRole = Azure.ResourceManager.Redis.Models.RedisLinkedServerRole.Primary, string geoReplicatedPrimaryHostName = null, string primaryHostName = null) { throw null; } - public static Azure.ResourceManager.Redis.RedisLinkedServerWithPropertyData RedisLinkedServerWithPropertyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier linkedRedisCacheId = null, Azure.Core.AzureLocation? linkedRedisCacheLocation = default(Azure.Core.AzureLocation?), Azure.ResourceManager.Redis.Models.RedisLinkedServerRole? serverRole = default(Azure.ResourceManager.Redis.Models.RedisLinkedServerRole?), string geoReplicatedPrimaryHostName = null, string primaryHostName = null, string provisioningState = null) { throw null; } - public static Azure.ResourceManager.Redis.Models.RedisOperationStatus RedisOperationStatus(Azure.Core.ResourceIdentifier id = null, string name = null, string status = null, float? percentComplete = default(float?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable operations = null, Azure.ResponseError error = null, System.Collections.Generic.IReadOnlyDictionary properties = null) { throw null; } - public static Azure.ResourceManager.Redis.RedisPatchScheduleData RedisPatchScheduleData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IEnumerable scheduleEntries = null) { throw null; } + public static Azure.ResourceManager.Redis.Models.RedisLinkedServerWithPropertyCreateOrUpdateContent RedisLinkedServerWithPropertyCreateOrUpdateContent(string linkedRedisCacheId = null, string linkedRedisCacheLocation = null, Azure.ResourceManager.Redis.Models.RedisLinkedServerRole serverRole = Azure.ResourceManager.Redis.Models.RedisLinkedServerRole.Primary, string geoReplicatedPrimaryHostName = null, string primaryHostName = null) { throw null; } + public static Azure.ResourceManager.Redis.RedisLinkedServerWithPropertyData RedisLinkedServerWithPropertyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string provisioningState = null) { throw null; } + public static Azure.ResourceManager.Redis.Models.RedisOperationStatus RedisOperationStatus(string id = null, string name = null, string status = null, double? percentComplete = default(double?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable operations = null, Azure.ResponseError error = null, System.Collections.Generic.IReadOnlyDictionary properties = null) { throw null; } + public static Azure.ResourceManager.Redis.RedisPatchScheduleData RedisPatchScheduleData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IEnumerable scheduleEntries = null, string location = null) { throw null; } public static Azure.ResourceManager.Redis.RedisPrivateEndpointConnectionData RedisPrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier privateEndpointId = null, Azure.ResourceManager.Redis.Models.RedisPrivateLinkServiceConnectionState redisPrivateLinkServiceConnectionState = null, Azure.ResourceManager.Redis.Models.RedisPrivateEndpointConnectionProvisioningState? redisProvisioningState = default(Azure.ResourceManager.Redis.Models.RedisPrivateEndpointConnectionProvisioningState?)) { throw null; } - public static Azure.ResourceManager.Redis.Models.RedisPrivateLinkResource RedisPrivateLinkResource(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } + public static Azure.ResourceManager.Redis.Models.RedisPrivateLinkResource RedisPrivateLinkResource(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.RedisPrivateLinkResourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.Redis.Models.RedisPrivateLinkResourceProperties RedisPrivateLinkResourceProperties(string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } public static Azure.ResourceManager.Redis.Models.RedisUpgradeNotification RedisUpgradeNotification(string name = null, System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), System.Collections.Generic.IReadOnlyDictionary upsellNotification = null) { throw null; } } public partial class ExportRdbContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel @@ -597,6 +567,24 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class OperationStatusResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal OperationStatusResult() { } + public System.DateTimeOffset? EndOn { get { throw null; } } + public Azure.ResponseError Error { get { throw null; } } + public string Id { get { throw null; } } + public string Name { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Operations { get { throw null; } } + public double? PercentComplete { get { throw null; } } + public System.DateTimeOffset? StartOn { get { throw null; } } + public string Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Redis.Models.OperationStatusResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Redis.Models.OperationStatusResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class RedisAccessKeys : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal RedisAccessKeys() { } @@ -615,15 +603,15 @@ public RedisCommonConfiguration() { } public System.Collections.Generic.IDictionary AdditionalProperties { get { throw null; } } public string AofStorageConnectionString0 { get { throw null; } set { } } public string AofStorageConnectionString1 { get { throw null; } set { } } - public string AuthNotRequired { 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; } } - public string MaxFragmentationMemoryReserved { get { throw null; } set { } } - public string MaxMemoryDelta { get { throw null; } set { } } - public string MaxMemoryPolicy { get { throw null; } set { } } - public string MaxMemoryReserved { get { throw null; } set { } } + public string Maxclients { get { throw null; } } + public string MaxfragmentationmemoryReserved { get { throw null; } set { } } + public string MaxmemoryDelta { get { throw null; } set { } } + public string MaxmemoryPolicy { get { throw null; } set { } } + public string MaxmemoryReserved { get { throw null; } set { } } public string NotifyKeyspaceEvents { get { throw null; } set { } } public string PreferredDataArchiveAuthMethod { get { throw null; } } public string PreferredDataPersistenceAuthMethod { get { throw null; } set { } } @@ -641,11 +629,11 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } public partial class RedisCreateOrUpdateContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public RedisCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.ResourceManager.Redis.Models.RedisSku sku) { } + public RedisCreateOrUpdateContent(Azure.ResourceManager.Redis.Models.RedisSku sku, string location) { } public bool? EnableNonSslPort { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public bool? IsAccessKeyAuthenticationDisabled { get { throw null; } set { } } - public Azure.Core.AzureLocation Location { get { throw null; } } + public string Location { get { throw null; } } public Azure.ResourceManager.Redis.Models.RedisTlsVersion? MinimumTlsVersion { get { throw null; } set { } } public Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } public Azure.ResourceManager.Redis.Models.RedisCommonConfiguration RedisConfiguration { get { throw null; } set { } } @@ -654,8 +642,8 @@ public RedisCreateOrUpdateContent(Azure.Core.AzureLocation location, Azure.Resou public int? ReplicasPerPrimary { get { throw null; } set { } } public int? ShardCount { get { throw null; } set { } } public Azure.ResourceManager.Redis.Models.RedisSku Sku { get { throw null; } } - public System.Net.IPAddress StaticIP { get { throw null; } set { } } - public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } + public string StaticIP { get { throw null; } set { } } + public string 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 { } } @@ -714,10 +702,10 @@ public enum RedisLinkedServerRole } public partial class RedisLinkedServerWithPropertyCreateOrUpdateContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public RedisLinkedServerWithPropertyCreateOrUpdateContent(Azure.Core.ResourceIdentifier linkedRedisCacheId, Azure.Core.AzureLocation linkedRedisCacheLocation, Azure.ResourceManager.Redis.Models.RedisLinkedServerRole serverRole) { } + public RedisLinkedServerWithPropertyCreateOrUpdateContent(string linkedRedisCacheId, string linkedRedisCacheLocation, Azure.ResourceManager.Redis.Models.RedisLinkedServerRole serverRole) { } public string GeoReplicatedPrimaryHostName { get { throw null; } } - public Azure.Core.ResourceIdentifier LinkedRedisCacheId { get { throw null; } } - public Azure.Core.AzureLocation LinkedRedisCacheLocation { get { throw null; } } + public string LinkedRedisCacheId { get { throw null; } } + public string LinkedRedisCacheLocation { get { throw null; } } public string PrimaryHostName { get { throw null; } } public Azure.ResourceManager.Redis.Models.RedisLinkedServerRole ServerRole { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -729,9 +717,9 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } public partial class RedisNameAvailabilityContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public RedisNameAvailabilityContent(string name, Azure.Core.ResourceType resourceType) { } + public RedisNameAvailabilityContent(string name, string type) { } public string Name { get { throw null; } } - public Azure.Core.ResourceType ResourceType { get { throw null; } } + public string Type { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.Models.RedisNameAvailabilityContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -739,7 +727,7 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } - public partial class RedisOperationStatus : Azure.ResourceManager.Models.OperationStatusResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + public partial class RedisOperationStatus : Azure.ResourceManager.Redis.Models.OperationStatusResult, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal RedisOperationStatus() { } public System.Collections.Generic.IReadOnlyDictionary Properties { get { throw null; } } @@ -753,21 +741,9 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public partial class RedisPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public RedisPatch() { } - public bool? EnableNonSslPort { get { throw null; } set { } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } - public bool? IsAccessKeyAuthenticationDisabled { get { throw null; } set { } } - public Azure.ResourceManager.Redis.Models.RedisTlsVersion? MinimumTlsVersion { get { throw null; } set { } } - public Azure.ResourceManager.Redis.Models.RedisPublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } - public Azure.ResourceManager.Redis.Models.RedisCommonConfiguration RedisConfiguration { get { throw null; } set { } } - public string RedisVersion { get { throw null; } set { } } - public int? ReplicasPerMaster { get { throw null; } set { } } - public int? ReplicasPerPrimary { get { throw null; } set { } } - public int? ShardCount { get { throw null; } set { } } 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 { } } - public Azure.ResourceManager.Redis.Models.ZonalAllocationPolicy? ZonalAllocationPolicy { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.Models.RedisPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -846,10 +822,8 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer } public partial class RedisPrivateLinkResource : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - public RedisPrivateLinkResource() { } - public string GroupId { get { throw null; } } - public System.Collections.Generic.IReadOnlyList RequiredMembers { get { throw null; } } - public System.Collections.Generic.IList RequiredZoneNames { get { throw null; } } + internal RedisPrivateLinkResource() { } + public Azure.ResourceManager.Redis.Models.RedisPrivateLinkResourceProperties Properties { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Redis.Models.RedisPrivateLinkResource System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -857,6 +831,19 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class RedisPrivateLinkResourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal RedisPrivateLinkResourceProperties() { } + public string GroupId { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RequiredMembers { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RequiredZoneNames { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Redis.Models.RedisPrivateLinkResourceProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Redis.Models.RedisPrivateLinkResourceProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class RedisPrivateLinkServiceConnectionState : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public RedisPrivateLinkServiceConnectionState() { } @@ -1024,6 +1011,9 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static Azure.ResourceManager.Redis.Models.RedisTlsVersion Tls1_0 { get { throw null; } } public static Azure.ResourceManager.Redis.Models.RedisTlsVersion Tls1_1 { get { throw null; } } public static Azure.ResourceManager.Redis.Models.RedisTlsVersion Tls1_2 { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.RedisTlsVersion _10 { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.RedisTlsVersion _11 { get { throw null; } } + public static Azure.ResourceManager.Redis.Models.RedisTlsVersion _12 { get { throw null; } } public bool Equals(Azure.ResourceManager.Redis.Models.RedisTlsVersion other) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public override bool Equals(object obj) { throw null; } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisCreateOrUpdateContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisCreateOrUpdateContent.cs new file mode 100644 index 000000000000..361841522475 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Customization/Models/RedisCreateOrUpdateContent.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Collections.Generic; + +namespace Azure.ResourceManager.Redis.Models +{ + public partial class RedisCreateOrUpdateContent + { + /// All Redis Settings. Few possible keys: rdb-backup-enabled,rdb-storage-connection-string,rdb-backup-frequency,maxmemory-delta, maxmemory-policy,notify-keyspace-events, aof-backup-enabled, aof-storage-connection-string-0, aof-storage-connection-string-1 etc. + [WirePath("properties.redisConfiguration")] + public RedisCommonConfiguration RedisConfiguration { get; set; } + /// 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'. + [WirePath("properties.redisVersion")] + public string RedisVersion { get; set; } + /// Specifies whether the non-ssl Redis server port (6379) is enabled. + [WirePath("properties.enableNonSslPort")] + public bool? EnableNonSslPort { get; set; } + /// The number of replicas to be created per primary. + [WirePath("properties.replicasPerMaster")] + public int? ReplicasPerMaster { get; set; } + /// The number of replicas to be created per primary. + [WirePath("properties.replicasPerPrimary")] + public int? ReplicasPerPrimary { get; set; } + /// A dictionary of tenant settings. + [WirePath("properties.tenantSettings")] + public IDictionary TenantSettings { get; } + /// The number of shards to be created on a Premium Cluster Cache. + [WirePath("properties.shardCount")] + public int? ShardCount { get; set; } + /// Optional: requires clients to use a specified TLS version (or higher) to connect (e,g, '1.0', '1.1', '1.2'). + [WirePath("properties.minimumTlsVersion")] + 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'. + [WirePath("properties.publicNetworkAccess")] + 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'. + [WirePath("properties.updateChannel")] + public UpdateChannel? UpdateChannel { get; set; } + /// Authentication to Redis through access keys is disabled when set as true. Default value is false. + [WirePath("properties.disableAccessKeyAuthentication")] + public bool? IsAccessKeyAuthenticationDisabled { get; set; } + /// Optional: Specifies how availability zones are allocated to the Redis cache. 'Automatic' enables zone redundancy and Azure will automatically select zones based on regional availability and capacity. 'UserDefined' will select availability zones passed in by you using the 'zones' parameter. 'NoZones' will produce a non-zonal cache. If 'zonalAllocationPolicy' is not passed, it will be set to 'UserDefined' when zones are passed in, otherwise, it will be set to 'Automatic' in regions where zones are supported and 'NoZones' in regions where zones are not supported. + [WirePath("properties.zonalAllocationPolicy")] + public ZonalAllocationPolicy? ZonalAllocationPolicy { get; set; } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Customization/RedisResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Customization/RedisResource.cs index 7278a92629e8..bd95d46d97ec 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Customization/RedisResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Customization/RedisResource.cs @@ -4,15 +4,10 @@ #nullable disable using System; -using System.Collections.Generic; using System.ComponentModel; -using System.Globalization; using System.Threading; using System.Threading.Tasks; -using Azure; using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager; using Azure.ResourceManager.Redis.Models; using Azure.ResourceManager.Resources; @@ -48,12 +43,12 @@ public virtual async Task> UpdateAsync(RedisPatch patch, { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Update"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.Update"); scope.Start(); try { - var response = await _redisResourceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new RedisArmOperation(new RedisResourceOperationSource(Client), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = await _redisRedisResourcesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new RedisOperationSource(Client), _redisRedisResourcesClientDiagnostics, Pipeline, _redisRedisResourcesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); return await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); } catch (Exception e) @@ -85,12 +80,12 @@ public virtual Response Update(RedisPatch patch, CancellationToke { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Update"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.Update"); scope.Start(); try { - var response = _redisResourceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - var operation = new RedisArmOperation(new RedisResourceOperationSource(Client), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = _redisRedisResourcesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new RedisArmOperation(new RedisOperationSource(Client), _redisRedisResourcesClientDiagnostics, Pipeline, _redisRedisResourcesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); return operation.WaitForCompletion(cancellationToken); } catch (Exception e) diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs index 4f6b1c69bf8e..d40e626a1605 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/ArmRedisModelFactory.cs @@ -17,24 +17,50 @@ namespace Azure.ResourceManager.Redis.Models /// Model factory for models. public static partial class ArmRedisModelFactory { - /// Initializes a new instance of . - /// Operation name: {provider}/{resource}/{operation}. - /// The object that describes the operation. - /// A new instance for mocking. - public static Operation Operation(string name = null, OperationDisplay display = null) + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// 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. + /// The availability zones. + /// The managed service identities assigned to this resource. + /// Resource tags. + /// The geo-location where the resource lives. + /// A new instance for mocking. + public static RedisData RedisData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = 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, IEnumerable zones = null, ManagedServiceIdentity identity = null, IReadOnlyDictionary tags = null, AzureLocation location = default) { - return new Operation(name, display, serializedAdditionalRawData: null); - } + linkedServers ??= new List(); + instances ??= new List(); + privateEndpointConnections ??= new List(); + zones ??= new List(); + tags ??= new Dictionary(); - /// Initializes a new instance of . - /// Friendly name of the resource provider. - /// Operation type: read, write, delete, listKeys/action, etc. - /// Resource type on which the operation is performed. - /// Friendly name of the operation. - /// A new instance for mocking. - public static OperationDisplay OperationDisplay(string provider = null, string operation = null, string resource = null, string description = null) - { - return new OperationDisplay(provider, operation, resource, description, serializedAdditionalRawData: null); + return new RedisData( + id, + name, + resourceType, + systemData, + provisioningState, + hostName, + port, + sslPort, + accessKeys, + linkedServers?.ToList(), + instances?.ToList(), + privateEndpointConnections?.ToList(), + zones?.ToList(), + identity, + tags, + location, + serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -137,7 +163,7 @@ public static RedisCommonConfiguration RedisCommonConfiguration(bool? isRdbBacku additionalProperties); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// 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. @@ -145,13 +171,13 @@ public static RedisCommonConfiguration RedisCommonConfiguration(bool? isRdbBacku /// The geo-location where the resource lives. /// Resource tags. /// The identity of the resource. - /// A new instance for mocking. - public static RedisResourceCreateOrUpdateContent RedisResourceCreateOrUpdateContent(RedisSku sku = null, string subnetId = null, string staticIP = null, IEnumerable zones = null, string location = null, IDictionary tags = null, ManagedServiceIdentity identity = null) + /// A new instance for mocking. + public static RedisCreateOrUpdateContent RedisCreateOrUpdateContent(RedisSku sku = null, string subnetId = null, string staticIP = null, IEnumerable zones = null, string location = null, IDictionary tags = null, ManagedServiceIdentity identity = null) { zones ??= new List(); tags ??= new Dictionary(); - return new RedisResourceCreateOrUpdateContent( + return new RedisCreateOrUpdateContent( sku, subnetId, staticIP, @@ -182,16 +208,16 @@ public static RedisForceRebootResult RedisForceRebootResult(string message = nul return new RedisForceRebootResult(message, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// File format. /// Prefix to use for exported files. /// Container name to export to. /// Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. /// Subscription id of the storage container for data to be exported using ManagedIdentity. - /// A new instance for mocking. - public static ExportRDBContent ExportRDBContent(string format = null, string prefix = null, string container = null, string preferredDataArchiveAuthMethod = null, string storageSubscriptionId = null) + /// A new instance for mocking. + public static ExportRdbContent ExportRdbContent(string format = null, string prefix = null, string container = null, string preferredDataArchiveAuthMethod = null, string storageSubscriptionId = null) { - return new ExportRDBContent( + return new ExportRdbContent( format, prefix, container, @@ -226,16 +252,16 @@ public static OperationStatusResult OperationStatusResult(string id = null, stri serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Resource properties. - /// A new instance for mocking. - public static RedisPrivateLinkResourceData RedisPrivateLinkResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, RedisPrivateLinkResourceProperties properties = null) + /// A new instance for mocking. + public static RedisPrivateLinkResource RedisPrivateLinkResource(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, RedisPrivateLinkResourceProperties properties = null) { - return new RedisPrivateLinkResourceData( + return new RedisPrivateLinkResource( id, name, resourceType, diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisResourceGroupResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisResourceGroupResource.cs index b222a461a83e..7049f39a01be 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisResourceGroupResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisResourceGroupResource.cs @@ -35,9 +35,9 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// Gets a collection of RedisResources in the ResourceGroupResource. /// An object representing collection of RedisResources and their operations over a RedisResource. - public virtual RedisResourceCollection GetRedisResources() + public virtual RedisCollection GetAllRedis() { - return GetCachedClient(client => new RedisResourceCollection(client, Id)); + return GetCachedClient(client => new RedisCollection(client, Id)); } /// @@ -66,9 +66,9 @@ public virtual RedisResourceCollection GetRedisResources() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetRedisResourceAsync(string name, CancellationToken cancellationToken = default) + public virtual async Task> GetRedisAsync(string name, CancellationToken cancellationToken = default) { - return await GetRedisResources().GetAsync(name, cancellationToken).ConfigureAwait(false); + return await GetAllRedis().GetAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -97,9 +97,9 @@ public virtual async Task> GetRedisResourceAsync(string /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetRedisResource(string name, CancellationToken cancellationToken = default) + public virtual Response GetRedis(string name, CancellationToken cancellationToken = default) { - return GetRedisResources().Get(name, cancellationToken); + return GetAllRedis().Get(name, cancellationToken); } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisSubscriptionResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisSubscriptionResource.cs index a7d1d78a9c3d..539a036d274d 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisSubscriptionResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisSubscriptionResource.cs @@ -18,8 +18,8 @@ namespace Azure.ResourceManager.Redis.Mocking /// A class to add extension methods to SubscriptionResource. public partial class MockableRedisSubscriptionResource : ArmResource { - private ClientDiagnostics _redisResourceClientDiagnostics; - private RedisResourcesRestOperations _redisResourceRestClient; + private ClientDiagnostics _redisRedisResourcesClientDiagnostics; + private RedisResourcesRestOperations _redisRedisResourcesRestClient; private ClientDiagnostics _redisOperationGroupClientDiagnostics; private RedisOperationGroupRestOperations _redisOperationGroupRestClient; private ClientDiagnostics _asyncOperationStatusOperationGroupClientDiagnostics; @@ -37,8 +37,8 @@ internal MockableRedisSubscriptionResource(ArmClient client, ResourceIdentifier { } - private ClientDiagnostics RedisResourceClientDiagnostics => _redisResourceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Redis", RedisResource.ResourceType.Namespace, Diagnostics); - private RedisResourcesRestOperations RedisResourceRestClient => _redisResourceRestClient ??= new RedisResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RedisResource.ResourceType)); + private ClientDiagnostics RedisRedisResourcesClientDiagnostics => _redisRedisResourcesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Redis", RedisResource.ResourceType.Namespace, Diagnostics); + private RedisResourcesRestOperations RedisRedisResourcesRestClient => _redisRedisResourcesRestClient ??= new RedisResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(RedisResource.ResourceType)); private ClientDiagnostics RedisOperationGroupClientDiagnostics => _redisOperationGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Redis", ProviderConstants.DefaultProviderNamespace, Diagnostics); private RedisOperationGroupRestOperations RedisOperationGroupRestClient => _redisOperationGroupRestClient ??= new RedisOperationGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics AsyncOperationStatusOperationGroupClientDiagnostics => _asyncOperationStatusOperationGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Redis", ProviderConstants.DefaultProviderNamespace, Diagnostics); @@ -75,9 +75,9 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable ListBySubscriptionAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => RedisResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisResourceData.DeserializeRedisResourceData(e)), RedisResourceClientDiagnostics, Pipeline, "MockableRedisSubscriptionResource.ListBySubscription", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => RedisRedisResourcesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisRedisResourcesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisData.DeserializeRedisData(e)), RedisRedisResourcesClientDiagnostics, Pipeline, "MockableRedisSubscriptionResource.ListBySubscription", "value", "nextLink", cancellationToken); } /// @@ -105,9 +105,9 @@ public virtual AsyncPageable ListBySubscriptionAsync(Cancellation /// A collection of that may take multiple service requests to iterate over. public virtual Pageable ListBySubscription(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => RedisResourceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisResourceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisResourceData.DeserializeRedisResourceData(e)), RedisResourceClientDiagnostics, Pipeline, "MockableRedisSubscriptionResource.ListBySubscription", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => RedisRedisResourcesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => RedisRedisResourcesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisData.DeserializeRedisData(e)), RedisRedisResourcesClientDiagnostics, Pipeline, "MockableRedisSubscriptionResource.ListBySubscription", "value", "nextLink", cancellationToken); } /// diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisTenantResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisTenantResource.cs deleted file mode 100644 index 39d5ecc25e19..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/MockableRedisTenantResource.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Threading; -using Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Redis.Models; - -namespace Azure.ResourceManager.Redis.Mocking -{ - /// A class to add extension methods to TenantResource. - public partial class MockableRedisTenantResource : ArmResource - { - private ClientDiagnostics _operationsClientDiagnostics; - private OperationsRestOperations _operationsRestClient; - - /// Initializes a new instance of the class for mocking. - protected MockableRedisTenantResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The identifier of the resource that is the target of operations. - internal MockableRedisTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - } - - private ClientDiagnostics OperationsClientDiagnostics => _operationsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Redis", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private OperationsRestOperations OperationsRestClient => _operationsRestClient ??= new OperationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - - private string GetApiVersionOrNull(ResourceType resourceType) - { - TryGetApiVersion(resourceType, out string apiVersion); - return apiVersion; - } - - /// - /// List the operations for the provider - /// - /// - /// Request Path - /// /providers/Microsoft.Cache/operations - /// - /// - /// Operation Id - /// Operations_List - /// - /// - /// Default Api Version - /// 2024-11-01 - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable ListAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OperationsRestClient.CreateListRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationsRestClient.CreateListNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => Models.Operation.DeserializeOperation(e), OperationsClientDiagnostics, Pipeline, "MockableRedisTenantResource.List", "value", "nextLink", cancellationToken); - } - - /// - /// List the operations for the provider - /// - /// - /// Request Path - /// /providers/Microsoft.Cache/operations - /// - /// - /// Operation Id - /// Operations_List - /// - /// - /// Default Api Version - /// 2024-11-01 - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable List(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => OperationsRestClient.CreateListRequest(); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OperationsRestClient.CreateListNextPageRequest(nextLink); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Models.Operation.DeserializeOperation(e), OperationsClientDiagnostics, Pipeline, "MockableRedisTenantResource.List", "value", "nextLink", cancellationToken); - } - } -} 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 009102e099e7..c16ae31de22c 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/RedisExtensions.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Extensions/RedisExtensions.cs @@ -33,11 +33,6 @@ private static MockableRedisSubscriptionResource GetMockableRedisSubscriptionRes return resource.GetCachedClient(client => new MockableRedisSubscriptionResource(client, resource.Id)); } - private static MockableRedisTenantResource GetMockableRedisTenantResource(ArmResource resource) - { - return resource.GetCachedClient(client => new MockableRedisTenantResource(client, resource.Id)); - } - /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -175,17 +170,17 @@ public static RedisCacheAccessPolicyAssignmentResource GetRedisCacheAccessPolicy /// Gets a collection of RedisResources in the ResourceGroupResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. /// An object representing collection of RedisResources and their operations over a RedisResource. - public static RedisResourceCollection GetRedisResources(this ResourceGroupResource resourceGroupResource) + public static RedisCollection GetAllRedis(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableRedisResourceGroupResource(resourceGroupResource).GetRedisResources(); + return GetMockableRedisResourceGroupResource(resourceGroupResource).GetAllRedis(); } /// @@ -210,7 +205,7 @@ public static RedisResourceCollection GetRedisResources(this ResourceGroupResour /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -219,11 +214,11 @@ public static RedisResourceCollection GetRedisResources(this ResourceGroupResour /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetRedisResourceAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) + public static async Task> GetRedisAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableRedisResourceGroupResource(resourceGroupResource).GetRedisResourceAsync(name, cancellationToken).ConfigureAwait(false); + return await GetMockableRedisResourceGroupResource(resourceGroupResource).GetRedisAsync(name, cancellationToken).ConfigureAwait(false); } /// @@ -248,7 +243,7 @@ public static async Task> GetRedisResourceAsync(this Res /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -257,11 +252,11 @@ public static async Task> GetRedisResourceAsync(this Res /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetRedisResource(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) + public static Response GetRedis(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableRedisResourceGroupResource(resourceGroupResource).GetRedisResource(name, cancellationToken); + return GetMockableRedisResourceGroupResource(resourceGroupResource).GetRedis(name, cancellationToken); } /// @@ -467,69 +462,5 @@ public static Response Get(this SubscriptionResource subsc return GetMockableRedisSubscriptionResource(subscriptionResource).Get(location, operationId, cancellationToken); } - - /// - /// List the operations for the provider - /// - /// - /// Request Path - /// /providers/Microsoft.Cache/operations - /// - /// - /// Operation Id - /// Operations_List - /// - /// - /// Default Api Version - /// 2024-11-01 - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The cancellation token to use. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable ListAsync(this TenantResource tenantResource, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - - return GetMockableRedisTenantResource(tenantResource).ListAsync(cancellationToken); - } - - /// - /// List the operations for the provider - /// - /// - /// Request Path - /// /providers/Microsoft.Cache/operations - /// - /// - /// Operation Id - /// Operations_List - /// - /// - /// Default Api Version - /// 2024-11-01 - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The cancellation token to use. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable List(this TenantResource tenantResource, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(tenantResource, nameof(tenantResource)); - - return GetMockableRedisTenantResource(tenantResource).List(cancellationToken); - } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/BicepSerializationHelpers.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/BicepSerializationHelpers.cs new file mode 100644 index 000000000000..29ab11b22d0d --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/BicepSerializationHelpers.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text; + +namespace Azure.ResourceManager.Redis +{ + internal static class BicepSerializationHelpers + { + public static void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName) + { + string indent = new string(' ', spaces); + int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length; + int length = stringBuilder.Length; + bool inMultilineString = false; + + BinaryData data = ModelReaderWriter.Write(childObject, options, AzureResourceManagerRedisContext.Default); + string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); + for (int i = 0; i < lines.Length; i++) + { + string line = lines[i]; + if (inMultilineString) + { + if (line.Contains("'''")) + { + inMultilineString = false; + } + stringBuilder.AppendLine(line); + continue; + } + if (line.Contains("'''")) + { + inMultilineString = true; + stringBuilder.AppendLine($"{indent}{line}"); + continue; + } + if (i == 0 && !indentFirstLine) + { + stringBuilder.AppendLine($"{line}"); + } + else + { + stringBuilder.AppendLine($"{indent}{line}"); + } + } + if (stringBuilder.Length == length + emptyObjectLength) + { + stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length; + } + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/WirePathAttribute.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/WirePathAttribute.cs new file mode 100644 index 000000000000..fe4bde9c9166 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Internal/WirePathAttribute.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Redis +{ + [AttributeUsage(AttributeTargets.Property)] + internal class WirePathAttribute : Attribute + { + private string _wirePath; + + public WirePathAttribute(string wirePath) + { + _wirePath = wirePath; + } + + public override string ToString() + { + return _wirePath; + } + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisResourceOperationSource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisOperationSource.cs similarity index 65% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisResourceOperationSource.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisOperationSource.cs index 33574c2ec9ac..6cdac40f9e50 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisResourceOperationSource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/LongRunningOperation/RedisOperationSource.cs @@ -12,24 +12,24 @@ namespace Azure.ResourceManager.Redis { - internal class RedisResourceOperationSource : IOperationSource + internal class RedisOperationSource : IOperationSource { private readonly ArmClient _client; - internal RedisResourceOperationSource(ArmClient client) + internal RedisOperationSource(ArmClient client) { _client = client; } RedisResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerRedisContext.Default); + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerRedisContext.Default); return new RedisResource(_client, data); } async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) { - var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerRedisContext.Default); + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerRedisContext.Default); return await Task.FromResult(new RedisResource(_client, data)).ConfigureAwait(false); } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AzureResourceManagerRedisContext.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AzureResourceManagerRedisContext.cs index ae4f40fba3e9..25850745a163 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AzureResourceManagerRedisContext.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/AzureResourceManagerRedisContext.cs @@ -16,12 +16,9 @@ namespace Azure.ResourceManager.Redis /// Context class which will be filled in by the System.ClientModel.SourceGeneration. /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' /// - [ModelReaderWriterBuildable(typeof(ExportRDBContent))] - [ModelReaderWriterBuildable(typeof(ImportRDBContent))] + [ModelReaderWriterBuildable(typeof(ExportRdbContent))] + [ModelReaderWriterBuildable(typeof(ImportRdbContent))] [ModelReaderWriterBuildable(typeof(ManagedServiceIdentity))] - [ModelReaderWriterBuildable(typeof(Models.Operation))] - [ModelReaderWriterBuildable(typeof(OperationDisplay))] - [ModelReaderWriterBuildable(typeof(OperationListResult))] [ModelReaderWriterBuildable(typeof(Models.OperationStatusResult))] [ModelReaderWriterBuildable(typeof(RedisAccessKeys))] [ModelReaderWriterBuildable(typeof(RedisCacheAccessPolicyAssignmentData))] @@ -31,6 +28,8 @@ namespace Azure.ResourceManager.Redis [ModelReaderWriterBuildable(typeof(RedisCacheAccessPolicyList))] [ModelReaderWriterBuildable(typeof(RedisCacheAccessPolicyResource))] [ModelReaderWriterBuildable(typeof(RedisCommonConfiguration))] + [ModelReaderWriterBuildable(typeof(RedisCreateOrUpdateContent))] + [ModelReaderWriterBuildable(typeof(RedisData))] [ModelReaderWriterBuildable(typeof(RedisFirewallRuleData))] [ModelReaderWriterBuildable(typeof(RedisFirewallRuleListResult))] [ModelReaderWriterBuildable(typeof(RedisFirewallRuleResource))] @@ -51,15 +50,13 @@ namespace Azure.ResourceManager.Redis [ModelReaderWriterBuildable(typeof(RedisPrivateEndpointConnectionData))] [ModelReaderWriterBuildable(typeof(RedisPrivateEndpointConnectionListResult))] [ModelReaderWriterBuildable(typeof(RedisPrivateEndpointConnectionResource))] - [ModelReaderWriterBuildable(typeof(RedisPrivateLinkResourceData))] + [ModelReaderWriterBuildable(typeof(RedisPrivateLinkResource))] [ModelReaderWriterBuildable(typeof(RedisPrivateLinkResourceListResult))] [ModelReaderWriterBuildable(typeof(RedisPrivateLinkResourceProperties))] [ModelReaderWriterBuildable(typeof(RedisPrivateLinkServiceConnectionState))] [ModelReaderWriterBuildable(typeof(RedisRebootContent))] [ModelReaderWriterBuildable(typeof(RedisRegenerateKeyContent))] [ModelReaderWriterBuildable(typeof(RedisResource))] - [ModelReaderWriterBuildable(typeof(RedisResourceCreateOrUpdateContent))] - [ModelReaderWriterBuildable(typeof(RedisResourceData))] [ModelReaderWriterBuildable(typeof(RedisSku))] [ModelReaderWriterBuildable(typeof(RedisUpgradeNotification))] [ModelReaderWriterBuildable(typeof(RedisUpgradeNotificationListResponse))] diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.Serialization.cs index 0ae85be9fa71..3a2f9301afed 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Redis.Models { - public partial class ExportRDBContent : IUtf8JsonSerializable, IJsonModel + public partial class ExportRdbContent : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ExportRDBContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ExportRdbContent)} does not support writing '{format}' format."); } if (Optional.IsDefined(Format)) @@ -70,19 +70,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ExportRDBContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ExportRdbContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ExportRDBContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ExportRdbContent)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeExportRDBContent(document.RootElement, options); + return DeserializeExportRdbContent(document.RootElement, options); } - internal static ExportRDBContent DeserializeExportRDBContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static ExportRdbContent DeserializeExportRdbContent(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -130,7 +130,7 @@ internal static ExportRDBContent DeserializeExportRDBContent(JsonElement element } } serializedAdditionalRawData = rawDataDictionary; - return new ExportRDBContent( + return new ExportRdbContent( format, prefix, container, @@ -139,35 +139,35 @@ internal static ExportRDBContent DeserializeExportRDBContent(JsonElement element serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); default: - throw new FormatException($"The model {nameof(ExportRDBContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ExportRdbContent)} does not support writing '{options.Format}' format."); } } - ExportRDBContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ExportRdbContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeExportRDBContent(document.RootElement, options); + return DeserializeExportRdbContent(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ExportRDBContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ExportRdbContent)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.cs index c00302535dae..ee72935033bc 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ExportRdbContent.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Parameters for Redis export operation. - public partial class ExportRDBContent + public partial class ExportRdbContent { /// /// Keeps track of any properties unknown to the library. @@ -45,11 +45,11 @@ public partial class ExportRDBContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// Prefix to use for exported files. /// Container name to export to. /// or is null. - public ExportRDBContent(string prefix, string container) + public ExportRdbContent(string prefix, string container) { Argument.AssertNotNull(prefix, nameof(prefix)); Argument.AssertNotNull(container, nameof(container)); @@ -58,14 +58,14 @@ public ExportRDBContent(string prefix, string container) Container = container; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// File format. /// Prefix to use for exported files. /// Container name to export to. /// Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. /// Subscription id of the storage container for data to be exported using ManagedIdentity. /// Keeps track of any properties unknown to the library. - internal ExportRDBContent(string format, string prefix, string container, string preferredDataArchiveAuthMethod, string storageSubscriptionId, IDictionary serializedAdditionalRawData) + internal ExportRdbContent(string format, string prefix, string container, string preferredDataArchiveAuthMethod, string storageSubscriptionId, IDictionary serializedAdditionalRawData) { Format = format; Prefix = prefix; @@ -75,20 +75,25 @@ internal ExportRDBContent(string format, string prefix, string container, string _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ExportRDBContent() + /// Initializes a new instance of for deserialization. + internal ExportRdbContent() { } /// File format. + [WirePath("format")] public string Format { get; set; } /// Prefix to use for exported files. + [WirePath("prefix")] public string Prefix { get; } /// Container name to export to. + [WirePath("container")] public string Container { get; } /// Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. + [WirePath("preferred-data-archive-auth-method")] public string PreferredDataArchiveAuthMethod { get; set; } /// Subscription id of the storage container for data to be exported using ManagedIdentity. + [WirePath("storage-subscription-id")] public string StorageSubscriptionId { get; set; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.Serialization.cs index 4f0243b326ee..546039fa964b 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.Redis.Models { - public partial class ImportRDBContent : IUtf8JsonSerializable, IJsonModel + public partial class ImportRdbContent : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -28,10 +28,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ImportRDBContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ImportRdbContent)} does not support writing '{format}' format."); } if (Optional.IsDefined(Format)) @@ -73,19 +73,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ImportRDBContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ImportRdbContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ImportRDBContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ImportRdbContent)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeImportRDBContent(document.RootElement, options); + return DeserializeImportRdbContent(document.RootElement, options); } - internal static ImportRDBContent DeserializeImportRDBContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static ImportRdbContent DeserializeImportRdbContent(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -132,38 +132,38 @@ internal static ImportRDBContent DeserializeImportRDBContent(JsonElement element } } serializedAdditionalRawData = rawDataDictionary; - return new ImportRDBContent(format, files, preferredDataArchiveAuthMethod, storageSubscriptionId, serializedAdditionalRawData); + return new ImportRdbContent(format, files, preferredDataArchiveAuthMethod, storageSubscriptionId, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); default: - throw new FormatException($"The model {nameof(ImportRDBContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ImportRdbContent)} does not support writing '{options.Format}' format."); } } - ImportRDBContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ImportRdbContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeImportRDBContent(document.RootElement, options); + return DeserializeImportRdbContent(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ImportRDBContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ImportRdbContent)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.cs index 3da4453a42df..2bd61983c0e1 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ImportRdbContent.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Parameters for Redis import operation. - public partial class ImportRDBContent + public partial class ImportRdbContent { /// /// Keeps track of any properties unknown to the library. @@ -46,23 +46,23 @@ public partial class ImportRDBContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// files to import. /// is null. - public ImportRDBContent(IEnumerable files) + public ImportRdbContent(IEnumerable files) { Argument.AssertNotNull(files, nameof(files)); Files = files.ToList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// File format. /// files to import. /// Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. /// Subscription id of the storage container containing files to import using Managed Identity. /// Keeps track of any properties unknown to the library. - internal ImportRDBContent(string format, IList files, string preferredDataArchiveAuthMethod, string storageSubscriptionId, IDictionary serializedAdditionalRawData) + internal ImportRdbContent(string format, IList files, string preferredDataArchiveAuthMethod, string storageSubscriptionId, IDictionary serializedAdditionalRawData) { Format = format; Files = files; @@ -71,18 +71,22 @@ internal ImportRDBContent(string format, IList files, string preferredDa _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ImportRDBContent() + /// Initializes a new instance of for deserialization. + internal ImportRdbContent() { } /// File format. + [WirePath("format")] public string Format { get; set; } /// files to import. + [WirePath("files")] public IList Files { get; } /// Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. + [WirePath("preferred-data-archive-auth-method")] public string PreferredDataArchiveAuthMethod { get; set; } /// Subscription id of the storage container containing files to import using Managed Identity. + [WirePath("storage-subscription-id")] public string StorageSubscriptionId { get; set; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.Serialization.cs deleted file mode 100644 index f724f4554002..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.Serialization.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Redis.Models -{ - public partial class Operation : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(Operation)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(Display)) - { - writer.WritePropertyName("display"u8); - writer.WriteObjectValue(Display, options); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - Operation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(Operation)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOperation(document.RootElement, options); - } - - internal static Operation DeserializeOperation(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - OperationDisplay display = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("display"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - display = OperationDisplay.DeserializeOperationDisplay(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new Operation(name, display, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - default: - throw new FormatException($"The model {nameof(Operation)} does not support writing '{options.Format}' format."); - } - } - - Operation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOperation(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(Operation)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.cs deleted file mode 100644 index 0e19501b0bb3..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/Operation.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.Redis.Models -{ - /// REST API operation. - public partial class Operation - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal Operation() - { - } - - /// Initializes a new instance of . - /// Operation name: {provider}/{resource}/{operation}. - /// The object that describes the operation. - /// Keeps track of any properties unknown to the library. - internal Operation(string name, OperationDisplay display, IDictionary serializedAdditionalRawData) - { - Name = name; - Display = display; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Operation name: {provider}/{resource}/{operation}. - public string Name { get; } - /// The object that describes the operation. - public OperationDisplay Display { get; } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.Serialization.cs deleted file mode 100644 index 52f609d2dffd..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.Serialization.cs +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Redis.Models -{ - public partial class OperationDisplay : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OperationDisplay)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Provider)) - { - writer.WritePropertyName("provider"u8); - writer.WriteStringValue(Provider); - } - if (Optional.IsDefined(Operation)) - { - writer.WritePropertyName("operation"u8); - writer.WriteStringValue(Operation); - } - if (Optional.IsDefined(Resource)) - { - writer.WritePropertyName("resource"u8); - writer.WriteStringValue(Resource); - } - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - OperationDisplay IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OperationDisplay)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOperationDisplay(document.RootElement, options); - } - - internal static OperationDisplay DeserializeOperationDisplay(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string provider = default; - string operation = default; - string resource = default; - string description = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("provider"u8)) - { - provider = property.Value.GetString(); - continue; - } - if (property.NameEquals("operation"u8)) - { - operation = property.Value.GetString(); - continue; - } - if (property.NameEquals("resource"u8)) - { - resource = property.Value.GetString(); - continue; - } - if (property.NameEquals("description"u8)) - { - description = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new OperationDisplay(provider, operation, resource, description, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - default: - throw new FormatException($"The model {nameof(OperationDisplay)} does not support writing '{options.Format}' format."); - } - } - - OperationDisplay IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOperationDisplay(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(OperationDisplay)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.cs deleted file mode 100644 index 8df1fcaff56c..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationDisplay.cs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.ResourceManager.Redis.Models -{ - /// The object that describes the operation. - public partial class OperationDisplay - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - internal OperationDisplay() - { - } - - /// Initializes a new instance of . - /// Friendly name of the resource provider. - /// Operation type: read, write, delete, listKeys/action, etc. - /// Resource type on which the operation is performed. - /// Friendly name of the operation. - /// Keeps track of any properties unknown to the library. - internal OperationDisplay(string provider, string operation, string resource, string description, IDictionary serializedAdditionalRawData) - { - Provider = provider; - Operation = operation; - Resource = resource; - Description = description; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Friendly name of the resource provider. - public string Provider { get; } - /// Operation type: read, write, delete, listKeys/action, etc. - public string Operation { get; } - /// Resource type on which the operation is performed. - public string Resource { get; } - /// Friendly name of the operation. - public string Description { get; } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.Serialization.cs deleted file mode 100644 index 65e9aa65d266..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.Serialization.cs +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ClientModel.Primitives; -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Redis.Models -{ - internal partial class OperationListResult : IUtf8JsonSerializable, IJsonModel - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - writer.WriteStartObject(); - JsonModelWriteCore(writer, options); - writer.WriteEndObject(); - } - - /// The JSON writer. - /// The client options for reading and writing models. - protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OperationListResult)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - if (Optional.IsDefined(NextLink)) - { - writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); - } - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - OperationListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - if (format != "J") - { - throw new FormatException($"The model {nameof(OperationListResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOperationListResult(document.RootElement, options); - } - - internal static OperationListResult DeserializeOperationListResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - string nextLink = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(Operation.DeserializeOperation(item, options)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new OperationListResult(value, nextLink, serializedAdditionalRawData); - } - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); - default: - throw new FormatException($"The model {nameof(OperationListResult)} does not support writing '{options.Format}' format."); - } - } - - OperationListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeOperationListResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(OperationListResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.cs deleted file mode 100644 index 6d06c5579ef4..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationListResult.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Azure.ResourceManager.Redis.Models -{ - /// Result of the request to list REST API operations. It contains a list of operations and a URL nextLink to get the next set of results. - internal partial class OperationListResult - { - /// - /// Keeps track of any properties unknown to the library. - /// - /// To assign an object to the value of this property use . - /// - /// - /// To assign an already formatted json string to this property use . - /// - /// - /// Examples: - /// - /// - /// BinaryData.FromObjectAsJson("foo") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromString("\"foo\"") - /// Creates a payload of "foo". - /// - /// - /// BinaryData.FromObjectAsJson(new { key = "value" }) - /// Creates a payload of { "key": "value" }. - /// - /// - /// BinaryData.FromString("{\"key\": \"value\"}") - /// Creates a payload of { "key": "value" }. - /// - /// - /// - /// - private IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - /// List of operations supported by the resource provider. - /// is null. - internal OperationListResult(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of . - /// List of operations supported by the resource provider. - /// URL to get the next set of operation list results if there are any. - /// Keeps track of any properties unknown to the library. - internal OperationListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) - { - Value = value; - NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal OperationListResult() - { - } - - /// List of operations supported by the resource provider. - public IReadOnlyList Value { get; } - /// URL to get the next set of operation list results if there are any. - public string NextLink { get; } - } -} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.Serialization.cs index f130e4ea67da..26594aba9af9 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -209,6 +210,175 @@ internal static OperationStatusResult DeserializeOperationStatusResult(JsonEleme serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + if (Id.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Id}'''"); + } + else + { + builder.AppendLine($"'{Id}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + if (Status.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Status}'''"); + } + else + { + builder.AppendLine($"'{Status}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PercentComplete), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" percentComplete: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PercentComplete)) + { + builder.Append(" percentComplete: "); + builder.AppendLine($"'{PercentComplete.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" startTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StartOn)) + { + builder.Append(" startTime: "); + var formattedDateTimeString = TypeFormatters.ToString(StartOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" endTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EndOn)) + { + builder.Append(" endTime: "); + var formattedDateTimeString = TypeFormatters.ToString(EndOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Operations), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" operations: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Operations)) + { + if (Operations.Any()) + { + builder.Append(" operations: "); + builder.AppendLine("["); + foreach (var item in Operations) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " operations: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Error), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" error: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Error)) + { + builder.Append(" error: "); + BicepSerializationHelpers.AppendChildObject(builder, Error, options, 2, false, " error: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -217,6 +387,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(OperationStatusResult)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.cs index 92a63f87d3c3..1f6735958b61 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/OperationStatusResult.cs @@ -85,20 +85,28 @@ internal OperationStatusResult() } /// Fully qualified ID for the async operation. + [WirePath("id")] public string Id { get; } /// Name of the async operation. + [WirePath("name")] public string Name { get; } /// Operation status. + [WirePath("status")] public string Status { get; } /// Percent of the operation that is complete. + [WirePath("percentComplete")] public double? PercentComplete { get; } /// The start time of the operation. + [WirePath("startTime")] public DateTimeOffset? StartOn { get; } /// The end time of the operation. + [WirePath("endTime")] public DateTimeOffset? EndOn { get; } /// The operations list. + [WirePath("operations")] public IReadOnlyList Operations { get; } /// If present, details of the operation error. + [WirePath("error")] public ResponseError Error { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.Serialization.cs index 6ec6d0af355c..0c96a3c7a1cc 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -106,6 +107,67 @@ internal static RedisAccessKeys DeserializeRedisAccessKeys(JsonElement element, return new RedisAccessKeys(primaryKey, secondaryKey, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrimaryKey), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" primaryKey: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PrimaryKey)) + { + builder.Append(" primaryKey: "); + if (PrimaryKey.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PrimaryKey}'''"); + } + else + { + builder.AppendLine($"'{PrimaryKey}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecondaryKey), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" secondaryKey: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecondaryKey)) + { + builder.Append(" secondaryKey: "); + if (SecondaryKey.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SecondaryKey}'''"); + } + else + { + builder.AppendLine($"'{SecondaryKey}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -114,6 +176,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opt { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisAccessKeys)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.cs index bda21d3d2fa3..71bef85e8a40 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisAccessKeys.cs @@ -62,8 +62,10 @@ internal RedisAccessKeys(string primaryKey, string secondaryKey, IDictionary The current primary key that clients can use to authenticate with Redis cache. + [WirePath("primaryKey")] public string PrimaryKey { get; } /// The current secondary key that clients can use to authenticate with Redis cache. + [WirePath("secondaryKey")] public string SecondaryKey { get; } } } 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 index bd67ffbac99d..643d4cca1f7f 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -117,6 +119,59 @@ internal static RedisCacheAccessPolicyAssignmentList DeserializeRedisCacheAccess return new RedisCacheAccessPolicyAssignmentList(value, nextLink, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -125,6 +180,8 @@ BinaryData IPersistableModel.Write(ModelRe { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisCacheAccessPolicyAssignmentList)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.cs index 4e30c9d41301..1541d05b4d12 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyAssignmentList.cs @@ -73,8 +73,10 @@ internal RedisCacheAccessPolicyAssignmentList() } /// The RedisCacheAccessPolicyAssignment items on this page. + [WirePath("value")] public IReadOnlyList Value { get; } /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } 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 index 154682b8ce7e..1d7541e8fad2 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -117,6 +119,59 @@ internal static RedisCacheAccessPolicyList DeserializeRedisCacheAccessPolicyList return new RedisCacheAccessPolicyList(value, nextLink, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -125,6 +180,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriter { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisCacheAccessPolicyList)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.cs index 01927a739717..45da9c296fa0 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCacheAccessPolicyList.cs @@ -73,8 +73,10 @@ internal RedisCacheAccessPolicyList() } /// The RedisCacheAccessPolicy items on this page. + [WirePath("value")] public IReadOnlyList Value { get; } /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.Serialization.cs index 3f4390b9a4b4..08debf37db91 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -307,6 +308,436 @@ internal static RedisCommonConfiguration DeserializeRedisCommonConfiguration(Jso additionalProperties); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsRdbBackupEnabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rdb-backup-enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsRdbBackupEnabled)) + { + builder.Append(" rdb-backup-enabled: "); + var boolValue = IsRdbBackupEnabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RdbBackupFrequency), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rdb-backup-frequency: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RdbBackupFrequency)) + { + builder.Append(" rdb-backup-frequency: "); + if (RdbBackupFrequency.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{RdbBackupFrequency}'''"); + } + else + { + builder.AppendLine($"'{RdbBackupFrequency}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RdbBackupMaxSnapshotCount), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rdb-backup-max-snapshot-count: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RdbBackupMaxSnapshotCount)) + { + builder.Append(" rdb-backup-max-snapshot-count: "); + builder.AppendLine($"{RdbBackupMaxSnapshotCount.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RdbStorageConnectionString), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rdb-storage-connection-string: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RdbStorageConnectionString)) + { + builder.Append(" rdb-storage-connection-string: "); + if (RdbStorageConnectionString.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{RdbStorageConnectionString}'''"); + } + else + { + builder.AppendLine($"'{RdbStorageConnectionString}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsAofBackupEnabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" aof-backup-enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsAofBackupEnabled)) + { + builder.Append(" aof-backup-enabled: "); + var boolValue = IsAofBackupEnabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AofStorageConnectionString0), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" aof-storage-connection-string-0: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AofStorageConnectionString0)) + { + builder.Append(" aof-storage-connection-string-0: "); + if (AofStorageConnectionString0.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{AofStorageConnectionString0}'''"); + } + else + { + builder.AppendLine($"'{AofStorageConnectionString0}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AofStorageConnectionString1), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" aof-storage-connection-string-1: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AofStorageConnectionString1)) + { + builder.Append(" aof-storage-connection-string-1: "); + if (AofStorageConnectionString1.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{AofStorageConnectionString1}'''"); + } + else + { + builder.AppendLine($"'{AofStorageConnectionString1}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxfragmentationmemoryReserved), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" maxfragmentationmemory-reserved: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MaxfragmentationmemoryReserved)) + { + builder.Append(" maxfragmentationmemory-reserved: "); + if (MaxfragmentationmemoryReserved.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MaxfragmentationmemoryReserved}'''"); + } + else + { + builder.AppendLine($"'{MaxfragmentationmemoryReserved}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxmemoryPolicy), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" maxmemory-policy: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MaxmemoryPolicy)) + { + builder.Append(" maxmemory-policy: "); + if (MaxmemoryPolicy.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MaxmemoryPolicy}'''"); + } + else + { + builder.AppendLine($"'{MaxmemoryPolicy}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxmemoryReserved), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" maxmemory-reserved: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MaxmemoryReserved)) + { + builder.Append(" maxmemory-reserved: "); + if (MaxmemoryReserved.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MaxmemoryReserved}'''"); + } + else + { + builder.AppendLine($"'{MaxmemoryReserved}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxmemoryDelta), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" maxmemory-delta: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MaxmemoryDelta)) + { + builder.Append(" maxmemory-delta: "); + if (MaxmemoryDelta.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MaxmemoryDelta}'''"); + } + else + { + builder.AppendLine($"'{MaxmemoryDelta}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Maxclients), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" maxclients: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Maxclients)) + { + builder.Append(" maxclients: "); + if (Maxclients.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Maxclients}'''"); + } + else + { + builder.AppendLine($"'{Maxclients}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NotifyKeyspaceEvents), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" notify-keyspace-events: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NotifyKeyspaceEvents)) + { + builder.Append(" notify-keyspace-events: "); + if (NotifyKeyspaceEvents.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NotifyKeyspaceEvents}'''"); + } + else + { + builder.AppendLine($"'{NotifyKeyspaceEvents}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PreferredDataArchiveAuthMethod), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" preferred-data-archive-auth-method: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PreferredDataArchiveAuthMethod)) + { + builder.Append(" preferred-data-archive-auth-method: "); + if (PreferredDataArchiveAuthMethod.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PreferredDataArchiveAuthMethod}'''"); + } + else + { + builder.AppendLine($"'{PreferredDataArchiveAuthMethod}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PreferredDataPersistenceAuthMethod), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" preferred-data-persistence-auth-method: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PreferredDataPersistenceAuthMethod)) + { + builder.Append(" preferred-data-persistence-auth-method: "); + if (PreferredDataPersistenceAuthMethod.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PreferredDataPersistenceAuthMethod}'''"); + } + else + { + builder.AppendLine($"'{PreferredDataPersistenceAuthMethod}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ZonalConfiguration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" zonal-configuration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ZonalConfiguration)) + { + builder.Append(" zonal-configuration: "); + if (ZonalConfiguration.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ZonalConfiguration}'''"); + } + else + { + builder.AppendLine($"'{ZonalConfiguration}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Authnotrequired), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" authnotrequired: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Authnotrequired)) + { + builder.Append(" authnotrequired: "); + if (Authnotrequired.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Authnotrequired}'''"); + } + else + { + builder.AppendLine($"'{Authnotrequired}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StorageSubscriptionId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" storage-subscription-id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StorageSubscriptionId)) + { + builder.Append(" storage-subscription-id: "); + if (StorageSubscriptionId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{StorageSubscriptionId}'''"); + } + else + { + builder.AppendLine($"'{StorageSubscriptionId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsAadEnabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" aad-enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsAadEnabled)) + { + builder.Append(" aad-enabled: "); + if (IsAadEnabled.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{IsAadEnabled}'''"); + } + else + { + builder.AppendLine($"'{IsAadEnabled}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -315,6 +746,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisCommonConfiguration)} does not support writing '{options.Format}' format."); } 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 a55d49274f3e..4d3d97715e82 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCommonConfiguration.cs @@ -65,42 +65,61 @@ internal RedisCommonConfiguration(bool? isRdbBackupEnabled, string rdbBackupFreq } /// Specifies whether the RDB backup is enabled. + [WirePath("rdb-backup-enabled")] public bool? IsRdbBackupEnabled { get; set; } /// Specifies the frequency for creating rdb backup in minutes. Valid values: (15, 30, 60, 360, 720, 1440). + [WirePath("rdb-backup-frequency")] public string RdbBackupFrequency { get; set; } /// Specifies the maximum number of snapshots for rdb backup. + [WirePath("rdb-backup-max-snapshot-count")] public int? RdbBackupMaxSnapshotCount { get; set; } /// The storage account connection string for storing rdb file. + [WirePath("rdb-storage-connection-string")] public string RdbStorageConnectionString { get; set; } /// Specifies whether the aof backup is enabled. + [WirePath("aof-backup-enabled")] public bool? IsAofBackupEnabled { get; set; } /// First storage account connection string. + [WirePath("aof-storage-connection-string-0")] public string AofStorageConnectionString0 { get; set; } /// Second storage account connection string. + [WirePath("aof-storage-connection-string-1")] public string AofStorageConnectionString1 { get; set; } /// Value in megabytes reserved for fragmentation per shard. + [WirePath("maxfragmentationmemory-reserved")] public string MaxfragmentationmemoryReserved { get; set; } /// The eviction strategy used when your data won't fit within its memory limit. + [WirePath("maxmemory-policy")] public string MaxmemoryPolicy { get; set; } /// Value in megabytes reserved for non-cache usage per shard e.g. failover. + [WirePath("maxmemory-reserved")] public string MaxmemoryReserved { get; set; } /// Value in megabytes reserved for non-cache usage per shard e.g. failover. + [WirePath("maxmemory-delta")] public string MaxmemoryDelta { get; set; } /// The max clients config. + [WirePath("maxclients")] public string Maxclients { get; } /// The keyspace events which should be monitored. + [WirePath("notify-keyspace-events")] public string NotifyKeyspaceEvents { get; set; } /// Preferred auth method to communicate to storage account used for data archive, specify SAS or ManagedIdentity, default value is SAS. + [WirePath("preferred-data-archive-auth-method")] public string PreferredDataArchiveAuthMethod { get; } /// Preferred auth method to communicate to storage account used for data persistence, specify SAS or ManagedIdentity, default value is SAS. + [WirePath("preferred-data-persistence-auth-method")] public string PreferredDataPersistenceAuthMethod { get; set; } /// Zonal Configuration. + [WirePath("zonal-configuration")] public string ZonalConfiguration { get; } /// Specifies whether the authentication is disabled. Setting this property is highly discouraged from security point of view; you should never disable authentication using this property!. + [WirePath("authnotrequired")] public string Authnotrequired { get; set; } /// SubscriptionId of the storage account for persistence (aof/rdb) using ManagedIdentity. + [WirePath("storage-subscription-id")] public string StorageSubscriptionId { get; set; } /// Specifies whether AAD based authentication has been enabled or disabled for the cache. + [WirePath("aad-enabled")] public string IsAadEnabled { get; set; } /// /// Additional Properties @@ -132,6 +151,7 @@ internal RedisCommonConfiguration(bool? isRdbBackupEnabled, string rdbBackupFreq /// /// /// + [WirePath("AdditionalProperties")] public IDictionary AdditionalProperties { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourceCreateOrUpdateContent.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.Serialization.cs similarity index 80% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourceCreateOrUpdateContent.Serialization.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.Serialization.cs index 10ad76311f14..7ed0e56a03e4 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourceCreateOrUpdateContent.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.Redis.Models { - public partial class RedisResourceCreateOrUpdateContent : IUtf8JsonSerializable, IJsonModel + public partial class RedisCreateOrUpdateContent : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -30,10 +30,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, /// The client options for reading and writing models. protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(RedisResourceCreateOrUpdateContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(RedisCreateOrUpdateContent)} does not support writing '{format}' format."); } if (Optional.IsCollectionDefined(Zones)) @@ -96,19 +96,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - RedisResourceCreateOrUpdateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + RedisCreateOrUpdateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(RedisResourceCreateOrUpdateContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(RedisCreateOrUpdateContent)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisResourceCreateOrUpdateContent(document.RootElement, options); + return DeserializeRedisCreateOrUpdateContent(document.RootElement, options); } - internal static RedisResourceCreateOrUpdateContent DeserializeRedisResourceCreateOrUpdateContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static RedisCreateOrUpdateContent DeserializeRedisCreateOrUpdateContent(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -202,7 +202,7 @@ internal static RedisResourceCreateOrUpdateContent DeserializeRedisResourceCreat } } serializedAdditionalRawData = rawDataDictionary; - return new RedisResourceCreateOrUpdateContent( + return new RedisCreateOrUpdateContent( sku, subnetId, staticIP, @@ -213,35 +213,35 @@ internal static RedisResourceCreateOrUpdateContent DeserializeRedisResourceCreat serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); default: - throw new FormatException($"The model {nameof(RedisResourceCreateOrUpdateContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisCreateOrUpdateContent)} does not support writing '{options.Format}' format."); } } - RedisResourceCreateOrUpdateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + RedisCreateOrUpdateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisResourceCreateOrUpdateContent(document.RootElement, options); + return DeserializeRedisCreateOrUpdateContent(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(RedisResourceCreateOrUpdateContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisCreateOrUpdateContent)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourceCreateOrUpdateContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.cs similarity index 86% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourceCreateOrUpdateContent.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.cs index b4755ede8b9e..d5476d13f6fe 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisResourceCreateOrUpdateContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisCreateOrUpdateContent.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Redis.Models { /// Parameters supplied to the Create Redis operation. - public partial class RedisResourceCreateOrUpdateContent + public partial class RedisCreateOrUpdateContent { /// /// Keeps track of any properties unknown to the library. @@ -46,11 +46,11 @@ public partial class RedisResourceCreateOrUpdateContent /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// The SKU of the Redis cache to deploy. /// The geo-location where the resource lives. /// or is null. - public RedisResourceCreateOrUpdateContent(RedisSku sku, string location) + public RedisCreateOrUpdateContent(RedisSku sku, string location) { Argument.AssertNotNull(sku, nameof(sku)); Argument.AssertNotNull(location, nameof(location)); @@ -61,7 +61,7 @@ public RedisResourceCreateOrUpdateContent(RedisSku sku, string location) Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// 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. @@ -70,7 +70,7 @@ public RedisResourceCreateOrUpdateContent(RedisSku sku, string location) /// Resource tags. /// The identity of the resource. /// Keeps track of any properties unknown to the library. - internal RedisResourceCreateOrUpdateContent(RedisSku sku, string subnetId, string staticIP, IList zones, string location, IDictionary tags, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) + internal RedisCreateOrUpdateContent(RedisSku sku, string subnetId, string staticIP, IList zones, string location, IDictionary tags, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) { Sku = sku; SubnetId = subnetId; @@ -82,24 +82,31 @@ internal RedisResourceCreateOrUpdateContent(RedisSku sku, string subnetId, strin _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal RedisResourceCreateOrUpdateContent() + /// Initializes a new instance of for deserialization. + internal RedisCreateOrUpdateContent() { } /// The SKU of the Redis cache to deploy. + [WirePath("properties.sku")] 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. + [WirePath("properties.subnetId")] public string SubnetId { get; set; } /// Static IP address. Optionally, may be specified when deploying a Redis cache inside an existing Azure Virtual Network; auto assigned by default. + [WirePath("properties.staticIP")] public string StaticIP { get; set; } /// A list of availability zones denoting where the resource needs to come from. + [WirePath("zones")] public IList Zones { get; } /// The geo-location where the resource lives. + [WirePath("location")] public string Location { get; } /// Resource tags. + [WirePath("tags")] public IDictionary Tags { get; } /// The identity of the resource. + [WirePath("identity")] public ManagedServiceIdentity Identity { get; set; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.Serialization.cs index 9853fb5e990d..71d8f9df705c 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -117,6 +119,59 @@ internal static RedisFirewallRuleListResult DeserializeRedisFirewallRuleListResu return new RedisFirewallRuleListResult(value, nextLink, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -125,6 +180,8 @@ BinaryData IPersistableModel.Write(ModelReaderWrite { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisFirewallRuleListResult)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.cs index 26b039501daa..ec55060b65bc 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisFirewallRuleListResult.cs @@ -73,8 +73,10 @@ internal RedisFirewallRuleListResult() } /// The RedisFirewallRule items on this page. + [WirePath("value")] public IReadOnlyList Value { get; } /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.Serialization.cs index 6ee8f737c1c8..c85ba00f5446 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -95,6 +96,44 @@ internal static RedisForceRebootResult DeserializeRedisForceRebootResult(JsonEle return new RedisForceRebootResult(message, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Message), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" message: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Message)) + { + builder.Append(" message: "); + if (Message.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Message}'''"); + } + else + { + builder.AppendLine($"'{Message}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -103,6 +142,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisForceRebootResult)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.cs index 10a927d87c38..d50ab852279f 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisForceRebootResult.cs @@ -60,6 +60,7 @@ internal RedisForceRebootResult(string message, IDictionary } /// Status message. + [WirePath("message")] public string Message { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.Serialization.cs index c95555873caf..8ad21976b2d8 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -177,6 +178,121 @@ internal static RedisInstanceDetails DeserializeRedisInstanceDetails(JsonElement serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SslPort), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sslPort: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SslPort)) + { + builder.Append(" sslPort: "); + builder.AppendLine($"{SslPort.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NonSslPort), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nonSslPort: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NonSslPort)) + { + builder.Append(" nonSslPort: "); + builder.AppendLine($"{NonSslPort.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Zone), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" zone: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Zone)) + { + builder.Append(" zone: "); + if (Zone.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Zone}'''"); + } + else + { + builder.AppendLine($"'{Zone}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ShardId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" shardId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ShardId)) + { + builder.Append(" shardId: "); + builder.AppendLine($"{ShardId.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsMaster), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isMaster: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsMaster)) + { + builder.Append(" isMaster: "); + var boolValue = IsMaster.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsPrimary), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isPrimary: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsPrimary)) + { + builder.Append(" isPrimary: "); + var boolValue = IsPrimary.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -185,6 +301,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOption { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisInstanceDetails)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.cs index 21663eb4c056..5ec865872750 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisInstanceDetails.cs @@ -70,16 +70,22 @@ internal RedisInstanceDetails(int? sslPort, int? nonSslPort, string zone, int? s } /// Redis instance SSL port. + [WirePath("sslPort")] public int? SslPort { get; } /// If enableNonSslPort is true, provides Redis instance Non-SSL port. + [WirePath("nonSslPort")] public int? NonSslPort { get; } /// If the Cache uses availability zones, specifies availability zone where this instance is located. + [WirePath("zone")] public string Zone { get; } /// If clustering is enabled, the Shard ID of Redis Instance. + [WirePath("shardId")] public int? ShardId { get; } /// Specifies whether the instance is a primary node. + [WirePath("isMaster")] public bool? IsMaster { get; } /// Specifies whether the instance is a primary node. + [WirePath("isPrimary")] public bool? IsPrimary { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.Serialization.cs index 572e1bbf09eb..77fe1042362b 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -117,6 +119,59 @@ internal static RedisLinkedServerWithPropertiesList DeserializeRedisLinkedServer return new RedisLinkedServerWithPropertiesList(value, nextLink, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -125,6 +180,8 @@ BinaryData IPersistableModel.Write(ModelRea { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisLinkedServerWithPropertiesList)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.cs index b3ab0651caa9..4ee0bc6939e1 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertiesList.cs @@ -73,8 +73,10 @@ internal RedisLinkedServerWithPropertiesList() } /// The RedisLinkedServerWithProperties items on this page. + [WirePath("value")] public IReadOnlyList Value { get; } /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.cs index f1edfb21a3a4..353a086f6d80 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisLinkedServerWithPropertyCreateOrUpdateContent.cs @@ -83,14 +83,19 @@ internal RedisLinkedServerWithPropertyCreateOrUpdateContent() } /// Fully qualified resourceId of the linked redis cache. + [WirePath("properties.linkedRedisCacheId")] public string LinkedRedisCacheId { get; } /// Location of the linked redis cache. + [WirePath("properties.linkedRedisCacheLocation")] public string LinkedRedisCacheLocation { get; } /// Role of the linked server. + [WirePath("properties.serverRole")] public RedisLinkedServerRole ServerRole { get; } /// The unchanging DNS name which will always point to current geo-primary cache among the linked redis caches for seamless Geo Failover experience. + [WirePath("properties.geoReplicatedPrimaryHostName")] public string GeoReplicatedPrimaryHostName { get; } /// The changing DNS name that resolves to the current geo-primary cache among the linked redis caches before or after the Geo Failover. + [WirePath("properties.primaryHostName")] public string PrimaryHostName { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.Serialization.cs index 3c01f679fa3f..30e4d1a857fe 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -83,7 +85,7 @@ internal static RedisListResult DeserializeRedisListResult(JsonElement element, { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -91,10 +93,10 @@ internal static RedisListResult DeserializeRedisListResult(JsonElement element, { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(RedisResourceData.DeserializeRedisResourceData(item, options)); + array.Add(RedisData.DeserializeRedisData(item, options)); } value = array; continue; @@ -117,6 +119,59 @@ internal static RedisListResult DeserializeRedisListResult(JsonElement element, return new RedisListResult(value, nextLink, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -125,6 +180,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opt { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisListResult)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.cs index d5a42fff1268..2021130cc7a4 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisListResult.cs @@ -49,7 +49,7 @@ internal partial class RedisListResult /// Initializes a new instance of . /// The RedisResource items on this page. /// is null. - internal RedisListResult(IEnumerable value) + internal RedisListResult(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); @@ -60,7 +60,7 @@ internal RedisListResult(IEnumerable value) /// The RedisResource items on this page. /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal RedisListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal RedisListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -73,8 +73,10 @@ internal RedisListResult() } /// The RedisResource items on this page. - public IReadOnlyList Value { get; } + [WirePath("value")] + public IReadOnlyList Value { get; } /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.cs index 2bb49d4668db..bca53d267a41 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisNameAvailabilityContent.cs @@ -75,8 +75,10 @@ internal RedisNameAvailabilityContent() } /// Resource name. + [WirePath("name")] public string Name { get; } /// Resource type. The only legal value of this property for checking redis cache name availability is 'Microsoft.Cache/redis'. + [WirePath("type")] public string Type { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.Serialization.cs index c586d20dfc72..006b7c6f6991 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -199,6 +200,204 @@ internal static RedisOperationStatus DeserializeRedisOperationStatus(JsonElement properties ?? new ChangeTrackingDictionary()); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Properties)) + { + if (Properties.Any()) + { + builder.Append(" properties: "); + builder.AppendLine("{"); + foreach (var item in Properties) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + builder.AppendLine($"'{item.Value.ToString()}'"); + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + if (Id.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Id}'''"); + } + else + { + builder.AppendLine($"'{Id}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + if (Status.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Status}'''"); + } + else + { + builder.AppendLine($"'{Status}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PercentComplete), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" percentComplete: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PercentComplete)) + { + builder.Append(" percentComplete: "); + builder.AppendLine($"'{PercentComplete.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" startTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StartOn)) + { + builder.Append(" startTime: "); + var formattedDateTimeString = TypeFormatters.ToString(StartOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" endTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EndOn)) + { + builder.Append(" endTime: "); + var formattedDateTimeString = TypeFormatters.ToString(EndOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Operations), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" operations: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Operations)) + { + if (Operations.Any()) + { + builder.Append(" operations: "); + builder.AppendLine("["); + foreach (var item in Operations) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " operations: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Error), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" error: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Error)) + { + builder.Append(" error: "); + BicepSerializationHelpers.AppendChildObject(builder, Error, options, 2, false, " error: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -207,6 +406,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOption { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisOperationStatus)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.cs index 32600c7f57b5..3a5fce02363f 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisOperationStatus.cs @@ -74,6 +74,7 @@ internal RedisOperationStatus() /// /// /// + [WirePath("properties")] public IReadOnlyDictionary Properties { get; } } } 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 e5fd1fec8cec..7e74874d1e16 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatch.cs @@ -66,10 +66,13 @@ internal RedisPatch(RedisSku sku, IDictionary tags, ManagedServi } /// The SKU of the Redis cache to deploy. + [WirePath("properties.sku")] public RedisSku Sku { get; set; } /// Resource tags. + [WirePath("tags")] public IDictionary Tags { get; } /// The identity of the resource. + [WirePath("identity")] public ManagedServiceIdentity Identity { get; set; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.Serialization.cs index 82aec68d64e0..35147ca88fa3 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -117,6 +119,59 @@ internal static RedisPatchScheduleListResult DeserializeRedisPatchScheduleListRe return new RedisPatchScheduleListResult(value, nextLink, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -125,6 +180,8 @@ BinaryData IPersistableModel.Write(ModelReaderWrit { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisPatchScheduleListResult)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.cs index f3b0b41336d7..4d2c10c15c4f 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleListResult.cs @@ -73,8 +73,10 @@ internal RedisPatchScheduleListResult() } /// The RedisPatchSchedule items on this page. + [WirePath("value")] public IReadOnlyList Value { get; } /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.Serialization.cs index 05ed2981fc4d..b6a918373ad3 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -115,6 +116,61 @@ internal static RedisPatchScheduleSetting DeserializeRedisPatchScheduleSetting(J return new RedisPatchScheduleSetting(dayOfWeek, startHourUtc, maintenanceWindow, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DayOfWeek), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dayOfWeek: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" dayOfWeek: "); + builder.AppendLine($"'{DayOfWeek.ToSerialString()}'"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartHourUtc), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" startHourUtc: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" startHourUtc: "); + builder.AppendLine($"{StartHourUtc}"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaintenanceWindow), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" maintenanceWindow: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MaintenanceWindow)) + { + builder.Append(" maintenanceWindow: "); + var formattedTimeSpan = TypeFormatters.ToString(MaintenanceWindow.Value, "P"); + builder.AppendLine($"'{formattedTimeSpan}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -123,6 +179,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisPatchScheduleSetting)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.cs index eb4709346d64..5d77f24cacb7 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPatchScheduleSetting.cs @@ -73,10 +73,13 @@ internal RedisPatchScheduleSetting() } /// Day of the week when a cache can be patched. + [WirePath("dayOfWeek")] public RedisDayOfWeek DayOfWeek { get; set; } /// Start hour after which cache patching can start. + [WirePath("startHourUtc")] public int StartHourUtc { get; set; } /// ISO8601 timespan specifying how much time cache patching can take. + [WirePath("maintenanceWindow")] public TimeSpan? MaintenanceWindow { get; set; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.Serialization.cs index 3d195f4f9638..5dd32406231d 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -117,6 +119,59 @@ internal static RedisPrivateEndpointConnectionListResult DeserializeRedisPrivate return new RedisPrivateEndpointConnectionListResult(value, nextLink, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -125,6 +180,8 @@ BinaryData IPersistableModel.Write(Mod { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisPrivateEndpointConnectionListResult)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.cs index 70763a057c05..2446259f4714 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateEndpointConnectionListResult.cs @@ -73,8 +73,10 @@ internal RedisPrivateEndpointConnectionListResult() } /// The PrivateEndpointConnection items on this page. + [WirePath("value")] public IReadOnlyList Value { get; } /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResource.Serialization.cs similarity index 50% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceData.Serialization.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResource.Serialization.cs index 6d3fdc0123a5..c7d43d006718 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResource.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.Redis.Models { - public partial class RedisPrivateLinkResourceData : IUtf8JsonSerializable, IJsonModel + public partial class RedisPrivateLinkResource : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -30,10 +30,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(RedisPrivateLinkResourceData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(RedisPrivateLinkResource)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -44,19 +44,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri } } - RedisPrivateLinkResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + RedisPrivateLinkResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(RedisPrivateLinkResourceData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(RedisPrivateLinkResource)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisPrivateLinkResourceData(document.RootElement, options); + return DeserializeRedisPrivateLinkResource(document.RootElement, options); } - internal static RedisPrivateLinkResourceData DeserializeRedisPrivateLinkResourceData(JsonElement element, ModelReaderWriterOptions options = null) + internal static RedisPrivateLinkResource DeserializeRedisPrivateLinkResource(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -112,7 +112,7 @@ internal static RedisPrivateLinkResourceData DeserializeRedisPrivateLinkResource } } serializedAdditionalRawData = rawDataDictionary; - return new RedisPrivateLinkResourceData( + return new RedisPrivateLinkResource( id, name, type, @@ -121,35 +121,120 @@ internal static RedisPrivateLinkResourceData DeserializeRedisPrivateLinkResource serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + private BinaryData SerializeBicep(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(RedisPrivateLinkResourceData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisPrivateLinkResource)} does not support writing '{options.Format}' format."); } } - RedisPrivateLinkResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + RedisPrivateLinkResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisPrivateLinkResourceData(document.RootElement, options); + return DeserializeRedisPrivateLinkResource(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(RedisPrivateLinkResourceData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisPrivateLinkResource)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResource.cs similarity index 83% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceData.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResource.cs index 3e828f6db2e4..807702404f19 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResource.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.Redis.Models { /// A private link resource. - public partial class RedisPrivateLinkResourceData : ResourceData + public partial class RedisPrivateLinkResource : ResourceData { /// /// Keeps track of any properties unknown to the library. @@ -47,25 +47,26 @@ public partial class RedisPrivateLinkResourceData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal RedisPrivateLinkResourceData() + /// Initializes a new instance of . + internal RedisPrivateLinkResource() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Resource properties. /// Keeps track of any properties unknown to the library. - internal RedisPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, RedisPrivateLinkResourceProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal RedisPrivateLinkResource(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, RedisPrivateLinkResourceProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Properties = properties; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource properties. + [WirePath("properties")] public RedisPrivateLinkResourceProperties Properties { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.Serialization.cs index e0efcf84ec0b..234a997a2a7f 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -83,7 +85,7 @@ internal static RedisPrivateLinkResourceListResult DeserializeRedisPrivateLinkRe { return null; } - IReadOnlyList value = default; + IReadOnlyList value = default; Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -91,10 +93,10 @@ internal static RedisPrivateLinkResourceListResult DeserializeRedisPrivateLinkRe { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(RedisPrivateLinkResourceData.DeserializeRedisPrivateLinkResourceData(item, options)); + array.Add(RedisPrivateLinkResource.DeserializeRedisPrivateLinkResource(item, options)); } value = array; continue; @@ -117,6 +119,59 @@ internal static RedisPrivateLinkResourceListResult DeserializeRedisPrivateLinkRe return new RedisPrivateLinkResourceListResult(value, nextLink, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -125,6 +180,8 @@ BinaryData IPersistableModel.Write(ModelRead { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisPrivateLinkResourceListResult)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.cs index c60d9289acad..4f5e9a3a65a9 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceListResult.cs @@ -49,7 +49,7 @@ internal partial class RedisPrivateLinkResourceListResult /// Initializes a new instance of . /// The PrivateLinkResource items on this page. /// is null. - internal RedisPrivateLinkResourceListResult(IEnumerable value) + internal RedisPrivateLinkResourceListResult(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); @@ -60,7 +60,7 @@ internal RedisPrivateLinkResourceListResult(IEnumerable The PrivateLinkResource items on this page. /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal RedisPrivateLinkResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + internal RedisPrivateLinkResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; @@ -73,8 +73,10 @@ internal RedisPrivateLinkResourceListResult() } /// The PrivateLinkResource items on this page. - public IReadOnlyList Value { get; } + [WirePath("value")] + public IReadOnlyList Value { get; } /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceProperties.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceProperties.Serialization.cs index 9f70aeec0807..8cf5bac60529 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceProperties.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceProperties.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -145,6 +147,116 @@ internal static RedisPrivateLinkResourceProperties DeserializeRedisPrivateLinkRe return new RedisPrivateLinkResourceProperties(groupId, requiredMembers ?? new ChangeTrackingList(), requiredZoneNames ?? new ChangeTrackingList(), serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GroupId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" groupId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(GroupId)) + { + builder.Append(" groupId: "); + if (GroupId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{GroupId}'''"); + } + else + { + builder.AppendLine($"'{GroupId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequiredMembers), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" requiredMembers: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(RequiredMembers)) + { + if (RequiredMembers.Any()) + { + builder.Append(" requiredMembers: "); + builder.AppendLine("["); + foreach (var item in RequiredMembers) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequiredZoneNames), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" requiredZoneNames: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(RequiredZoneNames)) + { + if (RequiredZoneNames.Any()) + { + builder.Append(" requiredZoneNames: "); + builder.AppendLine("["); + foreach (var item in RequiredZoneNames) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -153,6 +265,8 @@ BinaryData IPersistableModel.Write(ModelRead { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisPrivateLinkResourceProperties)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceProperties.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceProperties.cs index 80ab1d38e4ea..5ffe7cd5b977 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceProperties.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkResourceProperties.cs @@ -66,10 +66,13 @@ internal RedisPrivateLinkResourceProperties(string groupId, IReadOnlyList The private link resource group id. + [WirePath("groupId")] public string GroupId { get; } /// The private link resource required member names. + [WirePath("requiredMembers")] public IReadOnlyList RequiredMembers { get; } /// The private link resource private link DNS zone name. + [WirePath("requiredZoneNames")] public IReadOnlyList RequiredZoneNames { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.Serialization.cs index 24dcdb0d55ea..beee2a87bd27 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -121,6 +122,82 @@ internal static RedisPrivateLinkServiceConnectionState DeserializeRedisPrivateLi return new RedisPrivateLinkServiceConnectionState(status, description, actionsRequired, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + builder.AppendLine($"'{Status.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Description), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" description: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Description)) + { + builder.Append(" description: "); + if (Description.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Description}'''"); + } + else + { + builder.AppendLine($"'{Description}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ActionsRequired), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" actionsRequired: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ActionsRequired)) + { + builder.Append(" actionsRequired: "); + if (ActionsRequired.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ActionsRequired}'''"); + } + else + { + builder.AppendLine($"'{ActionsRequired}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -129,6 +206,8 @@ BinaryData IPersistableModel.Write(Model { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisPrivateLinkServiceConnectionState)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.cs index d091f26384de..8aeaf7cb82e1 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPrivateLinkServiceConnectionState.cs @@ -64,10 +64,13 @@ internal RedisPrivateLinkServiceConnectionState(RedisPrivateEndpointServiceConne } /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + [WirePath("status")] public RedisPrivateEndpointServiceConnectionStatus? Status { get; set; } /// The reason for approval/rejection of the connection. + [WirePath("description")] public string Description { get; set; } /// A message indicating if changes on the service provider require any updates on the consumer. + [WirePath("actionsRequired")] public string ActionsRequired { get; set; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPublicNetworkAccess.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPublicNetworkAccess.cs new file mode 100644 index 000000000000..067ae7b3b096 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisPublicNetworkAccess.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 +{ + /// 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 readonly partial struct RedisPublicNetworkAccess : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RedisPublicNetworkAccess(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Public internet access to the cache, via its public IP address, is enabled. Connections may use any network path. *. + public static RedisPublicNetworkAccess Enabled { get; } = new RedisPublicNetworkAccess(EnabledValue); + /// Public internet access to the cahce, via its public IP address, is disabled. Connections must use be made via private endpoints. *. + public static RedisPublicNetworkAccess Disabled { get; } = new RedisPublicNetworkAccess(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(RedisPublicNetworkAccess left, RedisPublicNetworkAccess right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RedisPublicNetworkAccess left, RedisPublicNetworkAccess right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RedisPublicNetworkAccess(string value) => new RedisPublicNetworkAccess(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RedisPublicNetworkAccess other && Equals(other); + /// + public bool Equals(RedisPublicNetworkAccess other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.cs index 1c81e87933b7..ca7161b22844 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRebootContent.cs @@ -65,10 +65,13 @@ internal RedisRebootContent(RedisRebootType? rebootType, int? shardId, IList Which Redis node(s) to reboot. Depending on this value data loss is possible. + [WirePath("rebootType")] public RedisRebootType? RebootType { get; set; } /// If clustering is enabled, the ID of the shard to be rebooted. + [WirePath("shardId")] public int? ShardId { get; set; } /// A list of redis instances to reboot, specified by per-instance SSL ports or non-SSL ports. + [WirePath("ports")] public IList Ports { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.cs index 7c2c4cb1d8c4..3feae7bd6f68 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisRegenerateKeyContent.cs @@ -67,6 +67,7 @@ internal RedisRegenerateKeyContent() } /// The Redis access key to regenerate. + [WirePath("keyType")] public RedisRegenerateKeyType KeyType { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.Serialization.cs index 4d7fba216cc5..f3ac1ad0883c 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -108,6 +109,57 @@ internal static RedisSku DeserializeRedisSku(JsonElement element, ModelReaderWri return new RedisSku(name, family, capacity, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" name: "); + builder.AppendLine($"'{Name.ToString()}'"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Family), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" family: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" family: "); + builder.AppendLine($"'{Family.ToString()}'"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Capacity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" capacity: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" capacity: "); + builder.AppendLine($"{Capacity}"); + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -116,6 +168,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisSku)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.cs index 0fd4ddbc9cb5..9560be2052dd 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisSku.cs @@ -75,10 +75,13 @@ internal RedisSku() } /// The type of Redis cache to deploy. Valid values: (Basic, Standard, Premium). + [WirePath("name")] public RedisSkuName Name { get; set; } /// The SKU family to use. Valid values: (C, P). (C = Basic/Standard, P = Premium). + [WirePath("family")] public RedisSkuFamily Family { get; set; } /// The size of the Redis cache to deploy. Valid values: for C (Basic/Standard) family (0, 1, 2, 3, 4, 5, 6), for P (Premium) family (1, 2, 3, 4). + [WirePath("capacity")] public int Capacity { get; set; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.Serialization.cs index 77d5cdf5085a..c09706ee592a 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -136,6 +138,97 @@ internal static RedisUpgradeNotification DeserializeRedisUpgradeNotification(Jso return new RedisUpgradeNotification(name, timestamp, upsellNotification ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Timestamp), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" timestamp: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Timestamp)) + { + builder.Append(" timestamp: "); + var formattedDateTimeString = TypeFormatters.ToString(Timestamp.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UpsellNotification), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" upsellNotification: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(UpsellNotification)) + { + if (UpsellNotification.Any()) + { + builder.Append(" upsellNotification: "); + builder.AppendLine("{"); + foreach (var item in UpsellNotification) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -144,6 +237,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisUpgradeNotification)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.cs index 5f1bc18c0c78..33b1941d27a0 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotification.cs @@ -65,10 +65,13 @@ internal RedisUpgradeNotification(string name, DateTimeOffset? timestamp, IReadO } /// Name of upgrade notification. + [WirePath("name")] public string Name { get; } /// Timestamp when upgrade notification occurred. + [WirePath("timestamp")] public DateTimeOffset? Timestamp { get; } /// Details about this upgrade notification. + [WirePath("upsellNotification")] public IReadOnlyDictionary UpsellNotification { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.Serialization.cs index 9273dff945a2..a175e4053624 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -117,6 +119,59 @@ internal static RedisUpgradeNotificationListResponse DeserializeRedisUpgradeNoti return new RedisUpgradeNotificationListResponse(value, nextLink, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -125,6 +180,8 @@ BinaryData IPersistableModel.Write(ModelRe { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisUpgradeNotificationListResponse)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.cs index dac4121ab719..b7a0276aa5ed 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/RedisUpgradeNotificationListResponse.cs @@ -73,8 +73,10 @@ internal RedisUpgradeNotificationListResponse() } /// The UpgradeNotification items on this page. + [WirePath("value")] public IReadOnlyList Value { get; } /// The link to the next page of items. + [WirePath("nextLink")] public Uri NextLink { get; } } } 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 000000000000..e2901661e20c --- /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 channel receives updates, which may include important security and stability updates, later than Preview channel. *. + public static UpdateChannel Stable { get; } = new UpdateChannel(StableValue); + /// Preview channel normally receives updates before Stable channel, and is the recommended channel for non-production workloads. *. + 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 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 != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ZonalAllocationPolicy.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ZonalAllocationPolicy.cs new file mode 100644 index 000000000000..be7c822e8323 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/Models/ZonalAllocationPolicy.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Redis.Models +{ + /// Optional: Specifies how availability zones are allocated to the Redis cache. 'Automatic' enables zone redundancy and Azure will automatically select zones based on regional availability and capacity. 'UserDefined' will select availability zones passed in by you using the 'zones' parameter. 'NoZones' will produce a non-zonal cache. If 'zonalAllocationPolicy' is not passed, it will be set to 'UserDefined' when zones are passed in, otherwise, it will be set to 'Automatic' in regions where zones are supported and 'NoZones' in regions where zones are not supported. + public readonly partial struct ZonalAllocationPolicy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ZonalAllocationPolicy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AutomaticValue = "Automatic"; + private const string UserDefinedValue = "UserDefined"; + private const string NoZonesValue = "NoZones"; + + /// The zones for the cache will be selected automatically based on availability and capacity. *. + public static ZonalAllocationPolicy Automatic { get; } = new ZonalAllocationPolicy(AutomaticValue); + /// UserDefined means the zones for the cache are manually configured using the 'zones' property, and can not be automatically selected. *. + public static ZonalAllocationPolicy UserDefined { get; } = new ZonalAllocationPolicy(UserDefinedValue); + /// The cache will not use multiple availability zones. *. + public static ZonalAllocationPolicy NoZones { get; } = new ZonalAllocationPolicy(NoZonesValue); + /// Determines if two values are the same. + public static bool operator ==(ZonalAllocationPolicy left, ZonalAllocationPolicy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ZonalAllocationPolicy left, ZonalAllocationPolicy right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ZonalAllocationPolicy(string value) => new ZonalAllocationPolicy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ZonalAllocationPolicy other && Equals(other); + /// + public bool Equals(ZonalAllocationPolicy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.Serialization.cs index 36fed7674442..6873c29c8641 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.Serialization.cs @@ -177,6 +177,153 @@ internal static RedisCacheAccessPolicyAssignmentData DeserializeRedisCacheAccess serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ObjectId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" objectId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ObjectId)) + { + builder.Append(" objectId: "); + builder.AppendLine($"'{ObjectId.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ObjectIdAlias), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" objectIdAlias: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ObjectIdAlias)) + { + builder.Append(" objectIdAlias: "); + if (ObjectIdAlias.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ObjectIdAlias}'''"); + } + else + { + builder.AppendLine($"'{ObjectIdAlias}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AccessPolicyName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" accessPolicyName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AccessPolicyName)) + { + builder.Append(" accessPolicyName: "); + if (AccessPolicyName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{AccessPolicyName}'''"); + } + else + { + builder.AppendLine($"'{AccessPolicyName}'"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -185,6 +332,8 @@ BinaryData IPersistableModel.Write(ModelRe { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisCacheAccessPolicyAssignmentData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs index 18f06bcb6fc5..23d79d236c2b 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyAssignmentData.cs @@ -76,12 +76,16 @@ internal RedisCacheAccessPolicyAssignmentData(ResourceIdentifier id, string name } /// Provisioning state of an access policy assignment set. + [WirePath("properties.provisioningState")] public AccessPolicyAssignmentProvisioningState? ProvisioningState { get; } /// Object Id to assign access policy to. + [WirePath("properties.objectId")] public Guid? ObjectId { get; set; } /// User friendly name for object id. Also represents username for token based authentication. + [WirePath("properties.objectIdAlias")] public string ObjectIdAlias { get; set; } /// The name of the access policy that is being assigned. + [WirePath("properties.accessPolicyName")] public string AccessPolicyName { get; set; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.Serialization.cs index fc7014dc6457..5b77ac04ab6a 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.Serialization.cs @@ -165,6 +165,130 @@ internal static RedisCacheAccessPolicyData DeserializeRedisCacheAccessPolicyData serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Type), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Type)) + { + builder.Append(" type: "); + builder.AppendLine($"'{Type.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Permissions), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" permissions: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Permissions)) + { + builder.Append(" permissions: "); + if (Permissions.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Permissions}'''"); + } + else + { + builder.AppendLine($"'{Permissions}'"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -173,6 +297,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriter { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisCacheAccessPolicyData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.cs index 948558088df9..f4cd6f7b423c 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCacheAccessPolicyData.cs @@ -74,10 +74,13 @@ internal RedisCacheAccessPolicyData(ResourceIdentifier id, string name, Resource } /// Provisioning state of access policy. + [WirePath("properties.provisioningState")] public AccessPolicyProvisioningState? ProvisioningState { get; } /// Built-In or Custom access policy. + [WirePath("properties.type")] public AccessPolicyType? Type { get; } /// Permissions for the access policy. Learn how to configure permissions at https://aka.ms/redis/AADPreRequisites. + [WirePath("properties.permissions")] public string Permissions { get; set; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCollection.cs similarity index 81% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceCollection.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCollection.cs index cdb1fc1a90a6..9547c6c1edf8 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisCollection.cs @@ -22,26 +22,26 @@ 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 GetRedisResources method from an instance of . + /// To get a instance call the GetRedis method from an instance of . /// - public partial class RedisResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class RedisCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _redisResourceClientDiagnostics; - private readonly RedisResourcesRestOperations _redisResourceRestClient; + private readonly ClientDiagnostics _redisRedisResourcesClientDiagnostics; + private readonly RedisResourcesRestOperations _redisRedisResourcesRestClient; - /// Initializes a new instance of the class for mocking. - protected RedisResourceCollection() + /// Initializes a new instance of the class for mocking. + protected RedisCollection() { } - /// Initializes a new instance of the class. + /// 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 RedisResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal RedisCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _redisResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", RedisResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(RedisResource.ResourceType, out string redisResourceApiVersion); - _redisResourceRestClient = new RedisResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisResourceApiVersion); + _redisRedisResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", RedisResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(RedisResource.ResourceType, out string redisRedisResourcesApiVersion); + _redisRedisResourcesRestClient = new RedisResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisRedisResourcesApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -80,17 +80,17 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string name, RedisResourceCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string name, RedisCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.CreateOrUpdate"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _redisResourceRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, name, content, cancellationToken).ConfigureAwait(false); - var operation = new RedisArmOperation(new RedisResourceOperationSource(Client), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, content).Request, response, OperationFinalStateVia.Location); + var response = await _redisRedisResourcesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, name, content, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new RedisOperationSource(Client), _redisRedisResourcesClientDiagnostics, Pipeline, _redisRedisResourcesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -129,17 +129,17 @@ public virtual async Task> CreateOrUpdateAsync(WaitU /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string name, RedisResourceCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string name, RedisCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(name, nameof(name)); Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.CreateOrUpdate"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisCollection.CreateOrUpdate"); scope.Start(); try { - var response = _redisResourceRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, name, content, cancellationToken); - var operation = new RedisArmOperation(new RedisResourceOperationSource(Client), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, content).Request, response, OperationFinalStateVia.Location); + var response = _redisRedisResourcesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, name, content, cancellationToken); + var operation = new RedisArmOperation(new RedisOperationSource(Client), _redisRedisResourcesClientDiagnostics, Pipeline, _redisRedisResourcesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -180,11 +180,11 @@ public virtual async Task> GetAsync(string name, Cancell { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.Get"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisCollection.Get"); scope.Start(); try { - var response = await _redisResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken).ConfigureAwait(false); + var response = await _redisRedisResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new RedisResource(Client, response.Value), response.GetRawResponse()); @@ -225,11 +225,11 @@ public virtual Response Get(string name, CancellationToken cancel { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.Get"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisCollection.Get"); scope.Start(); try { - var response = _redisResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken); + var response = _redisRedisResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new RedisResource(Client, response.Value), response.GetRawResponse()); @@ -266,9 +266,9 @@ public virtual Response Get(string name, CancellationToken cancel /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _redisResourceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisResourceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisResourceData.DeserializeRedisResourceData(e)), _redisResourceClientDiagnostics, Pipeline, "RedisResourceCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisRedisResourcesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisRedisResourcesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisData.DeserializeRedisData(e)), _redisRedisResourcesClientDiagnostics, Pipeline, "RedisCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -296,9 +296,9 @@ public virtual AsyncPageable GetAllAsync(CancellationToken cancel /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _redisResourceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisResourceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisResourceData.DeserializeRedisResourceData(e)), _redisResourceClientDiagnostics, Pipeline, "RedisResourceCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisRedisResourcesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisRedisResourcesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new RedisResource(Client, RedisData.DeserializeRedisData(e)), _redisRedisResourcesClientDiagnostics, Pipeline, "RedisCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -330,11 +330,11 @@ public virtual async Task> ExistsAsync(string name, CancellationT { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.Exists"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisCollection.Exists"); scope.Start(); try { - var response = await _redisResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _redisRedisResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -373,11 +373,11 @@ public virtual Response Exists(string name, CancellationToken cancellation { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.Exists"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisCollection.Exists"); scope.Start(); try { - var response = _redisResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + var response = _redisRedisResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -416,11 +416,11 @@ public virtual async Task> GetIfExistsAsync(stri { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.GetIfExists"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisCollection.GetIfExists"); scope.Start(); try { - var response = await _redisResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _redisRedisResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new RedisResource(Client, response.Value), response.GetRawResponse()); @@ -461,11 +461,11 @@ public virtual NullableResponse GetIfExists(string name, Cancella { Argument.AssertNotNullOrEmpty(name, nameof(name)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResourceCollection.GetIfExists"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisCollection.GetIfExists"); scope.Start(); try { - var response = _redisResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + var response = _redisRedisResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new RedisResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.Serialization.cs similarity index 52% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.Serialization.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.Serialization.cs index a748c41ca856..48340beb2c38 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -17,11 +18,11 @@ namespace Azure.ResourceManager.Redis { - public partial class RedisResourceData : IUtf8JsonSerializable, IJsonModel + public partial class RedisData : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { writer.WriteStartObject(); JsonModelWriteCore(writer, options); @@ -32,10 +33,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite /// The client options for reading and writing models. protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(RedisResourceData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(RedisData)} does not support writing '{format}' format."); } base.JsonModelWriteCore(writer, options); @@ -127,19 +128,19 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WriteEndObject(); } - RedisResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + RedisData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(RedisResourceData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(RedisData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeRedisResourceData(document.RootElement, options); + return DeserializeRedisData(document.RootElement, options); } - internal static RedisResourceData DeserializeRedisResourceData(JsonElement element, ModelReaderWriterOptions options = null) + internal static RedisData DeserializeRedisData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -334,7 +335,7 @@ internal static RedisResourceData DeserializeRedisResourceData(JsonElement eleme } } serializedAdditionalRawData = rawDataDictionary; - return new RedisResourceData( + return new RedisData( id, name, type, @@ -354,35 +355,360 @@ internal static RedisResourceData DeserializeRedisResourceData(JsonElement eleme serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + private BinaryData SerializeBicep(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" location: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" location: "); + builder.AppendLine($"'{Location.ToString()}'"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" tags: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Tags)) + { + if (Tags.Any()) + { + builder.Append(" tags: "); + builder.AppendLine("{"); + foreach (var item in Tags) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Zones), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" zones: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Zones)) + { + if (Zones.Any()) + { + builder.Append(" zones: "); + builder.AppendLine("["); + foreach (var item in Zones) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" identity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Identity)) + { + builder.Append(" identity: "); + BicepSerializationHelpers.AppendChildObject(builder, Identity, options, 2, false, " identity: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HostName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" hostName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(HostName)) + { + builder.Append(" hostName: "); + if (HostName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{HostName}'''"); + } + else + { + builder.AppendLine($"'{HostName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Port), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" port: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Port)) + { + builder.Append(" port: "); + builder.AppendLine($"{Port.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SslPort), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" sslPort: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SslPort)) + { + builder.Append(" sslPort: "); + builder.AppendLine($"{SslPort.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AccessKeys), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" accessKeys: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AccessKeys)) + { + builder.Append(" accessKeys: "); + BicepSerializationHelpers.AppendChildObject(builder, AccessKeys, options, 4, false, " accessKeys: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LinkedServers), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" linkedServers: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(LinkedServers)) + { + if (LinkedServers.Any()) + { + builder.Append(" linkedServers: "); + builder.AppendLine("["); + foreach (var item in LinkedServers) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " linkedServers: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Instances), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" instances: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Instances)) + { + if (Instances.Any()) + { + builder.Append(" instances: "); + builder.AppendLine("["); + foreach (var item in Instances) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " instances: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateEndpointConnections), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" privateEndpointConnections: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(PrivateEndpointConnections)) + { + if (PrivateEndpointConnections.Any()) + { + builder.Append(" privateEndpointConnections: "); + builder.AppendLine("["); + foreach (var item in PrivateEndpointConnections) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " privateEndpointConnections: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(RedisResourceData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisData)} does not support writing '{options.Format}' format."); } } - RedisResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + RedisData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeRedisResourceData(document.RootElement, options); + return DeserializeRedisData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(RedisResourceData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(RedisData)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.cs similarity index 81% rename from sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.cs rename to sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.cs index 292ea6364121..f42ba078d1fd 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResourceData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisData.cs @@ -15,10 +15,10 @@ namespace Azure.ResourceManager.Redis { /// - /// A class representing the RedisResource data model. + /// A class representing the Redis data model. /// A single Redis item in List or Get Operation. /// - public partial class RedisResourceData : ResourceData + public partial class RedisData : ResourceData { /// /// Keeps track of any properties unknown to the library. @@ -52,9 +52,9 @@ public partial class RedisResourceData : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// The geo-location where the resource lives. - internal RedisResourceData(AzureLocation location) + internal RedisData(AzureLocation location) { LinkedServers = new ChangeTrackingList(); Instances = new ChangeTrackingList(); @@ -64,7 +64,7 @@ internal RedisResourceData(AzureLocation location) Location = location; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -82,7 +82,7 @@ internal RedisResourceData(AzureLocation location) /// Resource tags. /// The geo-location where the resource lives. /// Keeps track of any properties unknown to the library. - internal RedisResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, RedisProvisioningState? provisioningState, string hostName, int? port, int? sslPort, RedisAccessKeys accessKeys, IReadOnlyList linkedServers, IReadOnlyList instances, IReadOnlyList privateEndpointConnections, IReadOnlyList zones, ManagedServiceIdentity identity, IReadOnlyDictionary tags, AzureLocation location, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal RedisData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, RedisProvisioningState? provisioningState, string hostName, int? port, int? sslPort, RedisAccessKeys accessKeys, IReadOnlyList linkedServers, IReadOnlyList instances, IReadOnlyList privateEndpointConnections, IReadOnlyList zones, ManagedServiceIdentity identity, IReadOnlyDictionary tags, AzureLocation location, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; HostName = hostName; @@ -99,34 +99,46 @@ internal RedisResourceData(ResourceIdentifier id, string name, ResourceType reso _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal RedisResourceData() + /// Initializes a new instance of for deserialization. + internal RedisData() { } /// Redis instance provisioning status. + [WirePath("properties.provisioningState")] public RedisProvisioningState? ProvisioningState { get; } /// Redis host name. + [WirePath("properties.hostName")] public string HostName { get; } /// Redis non-SSL port. + [WirePath("properties.port")] public int? Port { get; } /// Redis SSL port. + [WirePath("properties.sslPort")] public int? SslPort { get; } /// The keys of the Redis cache - not set if this object is not the response to Create or Update redis cache. + [WirePath("properties.accessKeys")] public RedisAccessKeys AccessKeys { get; } /// List of the linked servers associated with the cache. + [WirePath("properties.linkedServers")] public IReadOnlyList LinkedServers { get; } /// List of the Redis instances associated with the cache. + [WirePath("properties.instances")] public IReadOnlyList Instances { get; } /// List of private endpoint connection associated with the specified redis cache. + [WirePath("properties.privateEndpointConnections")] public IReadOnlyList PrivateEndpointConnections { get; } /// The availability zones. + [WirePath("zones")] public IReadOnlyList Zones { get; } /// The managed service identities assigned to this resource. + [WirePath("identity")] public ManagedServiceIdentity Identity { get; } /// Resource tags. + [WirePath("tags")] public IReadOnlyDictionary Tags { get; } /// The geo-location where the resource lives. + [WirePath("location")] public AzureLocation Location { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.Serialization.cs index f1c32ef0b48e..3a02494fb34e 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.Serialization.cs @@ -138,6 +138,123 @@ internal static RedisFirewallRuleData DeserializeRedisFirewallRuleData(JsonEleme serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartIP), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" startIP: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StartIP)) + { + builder.Append(" startIP: "); + if (StartIP.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{StartIP}'''"); + } + else + { + builder.AppendLine($"'{StartIP}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndIP), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" endIP: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EndIP)) + { + builder.Append(" endIP: "); + if (EndIP.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{EndIP}'''"); + } + else + { + builder.AppendLine($"'{EndIP}'"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -146,6 +263,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptio { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisFirewallRuleData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.cs index 1f61a43af024..bd0b3ea4ab71 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisFirewallRuleData.cs @@ -84,8 +84,10 @@ internal RedisFirewallRuleData() } /// lowest IP address included in the range. + [WirePath("properties.startIP")] public string StartIP { get; set; } /// highest IP address included in the range. + [WirePath("properties.endIP")] public string EndIP { get; set; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.Serialization.cs index f02ef820e7d6..a6aabd994a23 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.Serialization.cs @@ -132,6 +132,100 @@ internal static RedisLinkedServerWithPropertyData DeserializeRedisLinkedServerWi serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + if (ProvisioningState.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ProvisioningState}'''"); + } + else + { + builder.AppendLine($"'{ProvisioningState}'"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -140,6 +234,8 @@ BinaryData IPersistableModel.Write(ModelReade { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisLinkedServerWithPropertyData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.cs index ba7b68f6f655..2b612c9a02b7 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisLinkedServerWithPropertyData.cs @@ -69,6 +69,7 @@ internal RedisLinkedServerWithPropertyData(ResourceIdentifier id, string name, R } /// Terminal state of the link between primary and secondary redis cache. + [WirePath("properties.provisioningState")] public string ProvisioningState { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.Serialization.cs index 6bd8850dea3d..f67373e0cbca 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -152,6 +153,123 @@ internal static RedisPatchScheduleData DeserializeRedisPatchScheduleData(JsonEle serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" location: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Location)) + { + builder.Append(" location: "); + if (Location.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Location}'''"); + } + else + { + builder.AppendLine($"'{Location}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScheduleEntries), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" scheduleEntries: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ScheduleEntries)) + { + if (ScheduleEntries.Any()) + { + builder.Append(" scheduleEntries: "); + builder.AppendLine("["); + foreach (var item in ScheduleEntries) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " scheduleEntries: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -160,6 +278,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisPatchScheduleData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.cs index c6c4f4b60d77..0b877e40d887 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPatchScheduleData.cs @@ -83,8 +83,10 @@ internal RedisPatchScheduleData() } /// List of patch schedules for a Redis cache. + [WirePath("properties.scheduleEntries")] public IList ScheduleEntries { get; } /// The geo-location where the resource lives. + [WirePath("location")] public string Location { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.Serialization.cs index 1565dac36058..113afc78972d 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.Serialization.cs @@ -170,6 +170,127 @@ internal static RedisPrivateEndpointConnectionData DeserializeRedisPrivateEndpoi serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("PrivateEndpointId", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" privateEndpoint: "); + builder.AppendLine("{"); + builder.AppendLine(" privateEndpoint: {"); + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(PrivateEndpoint)) + { + builder.Append(" privateEndpoint: "); + BicepSerializationHelpers.AppendChildObject(builder, PrivateEndpoint, options, 4, false, " privateEndpoint: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RedisPrivateLinkServiceConnectionState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" privateLinkServiceConnectionState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RedisPrivateLinkServiceConnectionState)) + { + builder.Append(" privateLinkServiceConnectionState: "); + BicepSerializationHelpers.AppendChildObject(builder, RedisPrivateLinkServiceConnectionState, options, 4, false, " privateLinkServiceConnectionState: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RedisProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RedisProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{RedisProvisioningState.Value.ToString()}'"); + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -178,6 +299,8 @@ BinaryData IPersistableModel.Write(ModelRead { case "J": return ModelReaderWriter.Write(this, options, AzureResourceManagerRedisContext.Default); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(RedisPrivateEndpointConnectionData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.cs index 2cbabe67becd..4d2b43e36dac 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisPrivateEndpointConnectionData.cs @@ -77,14 +77,17 @@ internal RedisPrivateEndpointConnectionData(ResourceIdentifier id, string name, /// The private endpoint resource. internal SubResource PrivateEndpoint { get; set; } /// Gets Id. + [WirePath("properties.privateEndpoint.id")] public ResourceIdentifier PrivateEndpointId { get => PrivateEndpoint is null ? default : PrivateEndpoint.Id; } /// A collection of information about the state of the connection between service consumer and provider. + [WirePath("properties.privateLinkServiceConnectionState")] public RedisPrivateLinkServiceConnectionState RedisPrivateLinkServiceConnectionState { get; set; } /// The provisioning state of the private endpoint connection resource. + [WirePath("properties.provisioningState")] public RedisPrivateEndpointConnectionProvisioningState? RedisProvisioningState { get; } } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.Serialization.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.Serialization.cs index d34f9d9448bb..55f69a4f7802 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.Serialization.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.Serialization.cs @@ -11,19 +11,19 @@ namespace Azure.ResourceManager.Redis { - public partial class RedisResource : IJsonModel + public partial class RedisResource : IJsonModel { - private static RedisResourceData s_dataDeserializationInstance; - private static RedisResourceData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + private static RedisData s_dataDeserializationInstance; + private static RedisData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - RedisResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + RedisData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerRedisContext.Default); + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerRedisContext.Default); - RedisResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerRedisContext.Default); + RedisData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerRedisContext.Default); - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); } } diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs index c79817da3356..cde74f473697 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RedisResource.cs @@ -19,10 +19,10 @@ namespace Azure.ResourceManager.Redis { /// - /// A Class representing a RedisResource along with the instance operations that can be performed on it. + /// A Class representing a Redis 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 GetRedisResource method. - /// Otherwise you can get one from its parent resource using the GetRedisResource method. + /// Otherwise you can get one from its parent resource using the GetRedis method. /// public partial class RedisResource : ArmResource { @@ -36,9 +36,9 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _redisResourceClientDiagnostics; - private readonly RedisResourcesRestOperations _redisResourceRestClient; - private readonly RedisResourceData _data; + private readonly ClientDiagnostics _redisRedisResourcesClientDiagnostics; + private readonly RedisResourcesRestOperations _redisRedisResourcesRestClient; + private readonly RedisData _data; /// Gets the resource type for the operations. public static readonly ResourceType ResourceType = "Microsoft.Cache/redis"; @@ -51,7 +51,7 @@ protected RedisResource() /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The resource that is the target of operations. - internal RedisResource(ArmClient client, RedisResourceData data) : this(client, data.Id) + internal RedisResource(ArmClient client, RedisData data) : this(client, data.Id) { HasData = true; _data = data; @@ -62,9 +62,9 @@ internal RedisResource(ArmClient client, RedisResourceData data) : this(client, /// The identifier of the resource that is the target of operations. internal RedisResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _redisResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string redisResourceApiVersion); - _redisResourceRestClient = new RedisResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisResourceApiVersion); + _redisRedisResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Redis", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string redisRedisResourcesApiVersion); + _redisRedisResourcesRestClient = new RedisResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, redisRedisResourcesApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -75,7 +75,7 @@ internal RedisResource(ArmClient client, ResourceIdentifier id) : base(client, i /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual RedisResourceData Data + public virtual RedisData Data { get { @@ -91,7 +91,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); } - /// Gets a collection of RedisFirewallRuleResources in the RedisResource. + /// Gets a collection of RedisFirewallRuleResources in the Redis. /// An object representing collection of RedisFirewallRuleResources and their operations over a RedisFirewallRuleResource. public virtual RedisFirewallRuleCollection GetRedisFirewallRules() { @@ -160,7 +160,7 @@ public virtual Response GetRedisFirewallRule(string r return GetRedisFirewallRules().Get(ruleName, cancellationToken); } - /// Gets a collection of RedisPatchScheduleResources in the RedisResource. + /// Gets a collection of RedisPatchScheduleResources in the Redis. /// An object representing collection of RedisPatchScheduleResources and their operations over a RedisPatchScheduleResource. public virtual RedisPatchScheduleCollection GetRedisPatchSchedules() { @@ -225,7 +225,7 @@ public virtual Response GetRedisPatchSchedule(RedisP return GetRedisPatchSchedules().Get(@default, cancellationToken); } - /// Gets a collection of RedisLinkedServerWithPropertyResources in the RedisResource. + /// Gets a collection of RedisLinkedServerWithPropertyResources in the Redis. /// An object representing collection of RedisLinkedServerWithPropertyResources and their operations over a RedisLinkedServerWithPropertyResource. public virtual RedisLinkedServerWithPropertyCollection GetRedisLinkedServerWithProperties() { @@ -294,7 +294,7 @@ public virtual Response GetRedisLinkedSer return GetRedisLinkedServerWithProperties().Get(linkedServerName, cancellationToken); } - /// Gets a collection of RedisPrivateEndpointConnectionResources in the RedisResource. + /// Gets a collection of RedisPrivateEndpointConnectionResources in the Redis. /// An object representing collection of RedisPrivateEndpointConnectionResources and their operations over a RedisPrivateEndpointConnectionResource. public virtual RedisPrivateEndpointConnectionCollection GetRedisPrivateEndpointConnections() { @@ -363,7 +363,7 @@ public virtual Response GetRedisPrivateE return GetRedisPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); } - /// Gets a collection of RedisCacheAccessPolicyResources in the RedisResource. + /// Gets a collection of RedisCacheAccessPolicyResources in the Redis. /// An object representing collection of RedisCacheAccessPolicyResources and their operations over a RedisCacheAccessPolicyResource. public virtual RedisCacheAccessPolicyCollection GetRedisCacheAccessPolicies() { @@ -432,7 +432,7 @@ public virtual Response GetRedisCacheAccessPolic return GetRedisCacheAccessPolicies().Get(accessPolicyName, cancellationToken); } - /// Gets a collection of RedisCacheAccessPolicyAssignmentResources in the RedisResource. + /// Gets a collection of RedisCacheAccessPolicyAssignmentResources in the Redis. /// An object representing collection of RedisCacheAccessPolicyAssignmentResources and their operations over a RedisCacheAccessPolicyAssignmentResource. public virtual RedisCacheAccessPolicyAssignmentCollection GetRedisCacheAccessPolicyAssignments() { @@ -525,11 +525,11 @@ public virtual Response GetRedisCacheA /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Get"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.Get"); scope.Start(); try { - var response = await _redisResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _redisRedisResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new RedisResource(Client, response.Value), response.GetRawResponse()); @@ -565,11 +565,11 @@ public virtual async Task> GetAsync(CancellationToken ca /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Get"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.Get"); scope.Start(); try { - var response = _redisResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _redisRedisResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new RedisResource(Client, response.Value), response.GetRawResponse()); @@ -606,12 +606,12 @@ public virtual Response Get(CancellationToken cancellationToken = /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Delete"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.Delete"); scope.Start(); try { - var response = await _redisResourceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new RedisArmOperation(_redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _redisRedisResourcesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(_redisRedisResourcesClientDiagnostics, Pipeline, _redisRedisResourcesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -648,12 +648,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Delete"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.Delete"); scope.Start(); try { - var response = _redisResourceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new RedisArmOperation(_redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _redisRedisResourcesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new RedisArmOperation(_redisRedisResourcesClientDiagnostics, Pipeline, _redisRedisResourcesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -694,12 +694,12 @@ public virtual async Task> UpdateAsync(WaitUntil wai { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Update"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.Update"); scope.Start(); try { - var response = await _redisResourceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new RedisArmOperation(new RedisResourceOperationSource(Client), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = await _redisRedisResourcesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new RedisOperationSource(Client), _redisRedisResourcesClientDiagnostics, Pipeline, _redisRedisResourcesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -740,12 +740,12 @@ public virtual ArmOperation Update(WaitUntil waitUntil, RedisPatc { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.Update"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.Update"); scope.Start(); try { - var response = _redisResourceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); - var operation = new RedisArmOperation(new RedisResourceOperationSource(Client), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + var response = _redisRedisResourcesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new RedisArmOperation(new RedisOperationSource(Client), _redisRedisResourcesClientDiagnostics, Pipeline, _redisRedisResourcesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -783,9 +783,9 @@ public virtual ArmOperation Update(WaitUntil waitUntil, RedisPatc /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable ListUpgradeNotificationsAsync(double history, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _redisResourceRestClient.CreateListUpgradeNotificationsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisResourceRestClient.CreateListUpgradeNotificationsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => RedisUpgradeNotification.DeserializeRedisUpgradeNotification(e), _redisResourceClientDiagnostics, Pipeline, "RedisResource.ListUpgradeNotifications", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisRedisResourcesRestClient.CreateListUpgradeNotificationsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisRedisResourcesRestClient.CreateListUpgradeNotificationsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => RedisUpgradeNotification.DeserializeRedisUpgradeNotification(e), _redisRedisResourcesClientDiagnostics, Pipeline, "RedisResource.ListUpgradeNotifications", "value", "nextLink", cancellationToken); } /// @@ -814,9 +814,9 @@ public virtual AsyncPageable ListUpgradeNotificationsA /// A collection of that may take multiple service requests to iterate over. public virtual Pageable ListUpgradeNotifications(double history, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _redisResourceRestClient.CreateListUpgradeNotificationsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisResourceRestClient.CreateListUpgradeNotificationsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => RedisUpgradeNotification.DeserializeRedisUpgradeNotification(e), _redisResourceClientDiagnostics, Pipeline, "RedisResource.ListUpgradeNotifications", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisRedisResourcesRestClient.CreateListUpgradeNotificationsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisRedisResourcesRestClient.CreateListUpgradeNotificationsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, history); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => RedisUpgradeNotification.DeserializeRedisUpgradeNotification(e), _redisRedisResourcesClientDiagnostics, Pipeline, "RedisResource.ListUpgradeNotifications", "value", "nextLink", cancellationToken); } /// @@ -843,11 +843,11 @@ public virtual Pageable ListUpgradeNotifications(doubl /// The cancellation token to use. public virtual async Task> ListKeysAsync(CancellationToken cancellationToken = default) { - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ListKeys"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.ListKeys"); scope.Start(); try { - var response = await _redisResourceRestClient.ListKeysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _redisRedisResourcesRestClient.ListKeysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -881,11 +881,11 @@ public virtual async Task> ListKeysAsync(CancellationT /// The cancellation token to use. public virtual Response ListKeys(CancellationToken cancellationToken = default) { - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ListKeys"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.ListKeys"); scope.Start(); try { - var response = _redisResourceRestClient.ListKeys(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var response = _redisRedisResourcesRestClient.ListKeys(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return response; } catch (Exception e) @@ -923,11 +923,11 @@ public virtual async Task> RegenerateKeyAsync(RedisReg { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.RegenerateKey"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.RegenerateKey"); scope.Start(); try { - var response = await _redisResourceRestClient.RegenerateKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var response = await _redisRedisResourcesRestClient.RegenerateKeyAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -965,11 +965,11 @@ public virtual Response RegenerateKey(RedisRegenerateKeyContent { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.RegenerateKey"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.RegenerateKey"); scope.Start(); try { - var response = _redisResourceRestClient.RegenerateKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var response = _redisRedisResourcesRestClient.RegenerateKey(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); return response; } catch (Exception e) @@ -1007,11 +1007,11 @@ public virtual async Task> ForceRebootAsync(Red { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ForceReboot"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.ForceReboot"); scope.Start(); try { - var response = await _redisResourceRestClient.ForceRebootAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var response = await _redisRedisResourcesRestClient.ForceRebootAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -1049,11 +1049,11 @@ public virtual Response ForceReboot(RedisRebootContent c { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ForceReboot"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.ForceReboot"); scope.Start(); try { - var response = _redisResourceRestClient.ForceReboot(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var response = _redisRedisResourcesRestClient.ForceReboot(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); return response; } catch (Exception e) @@ -1088,16 +1088,16 @@ public virtual Response ForceReboot(RedisRebootContent c /// Parameters for Redis import operation. /// The cancellation token to use. /// is null. - public virtual async Task ImportDataAsync(WaitUntil waitUntil, ImportRDBContent content, CancellationToken cancellationToken = default) + public virtual async Task ImportDataAsync(WaitUntil waitUntil, ImportRdbContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ImportData"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.ImportData"); scope.Start(); try { - var response = await _redisResourceRestClient.ImportDataAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new RedisArmOperation(_redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateImportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = await _redisRedisResourcesRestClient.ImportDataAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(_redisRedisResourcesClientDiagnostics, Pipeline, _redisRedisResourcesRestClient.CreateImportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1134,16 +1134,16 @@ public virtual async Task ImportDataAsync(WaitUntil waitUntil, Imp /// Parameters for Redis import operation. /// The cancellation token to use. /// is null. - public virtual ArmOperation ImportData(WaitUntil waitUntil, ImportRDBContent content, CancellationToken cancellationToken = default) + public virtual ArmOperation ImportData(WaitUntil waitUntil, ImportRdbContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ImportData"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.ImportData"); scope.Start(); try { - var response = _redisResourceRestClient.ImportData(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); - var operation = new RedisArmOperation(_redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateImportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = _redisRedisResourcesRestClient.ImportData(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new RedisArmOperation(_redisRedisResourcesClientDiagnostics, Pipeline, _redisRedisResourcesRestClient.CreateImportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -1180,16 +1180,16 @@ public virtual ArmOperation ImportData(WaitUntil waitUntil, ImportRDBContent con /// Parameters for Redis export operation. /// The cancellation token to use. /// is null. - public virtual async Task ExportDataAsync(WaitUntil waitUntil, ExportRDBContent content, CancellationToken cancellationToken = default) + public virtual async Task ExportDataAsync(WaitUntil waitUntil, ExportRdbContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ExportData"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.ExportData"); scope.Start(); try { - var response = await _redisResourceRestClient.ExportDataAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new RedisArmOperation(_redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateExportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = await _redisRedisResourcesRestClient.ExportDataAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(_redisRedisResourcesClientDiagnostics, Pipeline, _redisRedisResourcesRestClient.CreateExportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1226,16 +1226,16 @@ public virtual async Task ExportDataAsync(WaitUntil waitUntil, Exp /// Parameters for Redis export operation. /// The cancellation token to use. /// is null. - public virtual ArmOperation ExportData(WaitUntil waitUntil, ExportRDBContent content, CancellationToken cancellationToken = default) + public virtual ArmOperation ExportData(WaitUntil waitUntil, ExportRdbContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNull(content, nameof(content)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.ExportData"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.ExportData"); scope.Start(); try { - var response = _redisResourceRestClient.ExportData(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); - var operation = new RedisArmOperation(_redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateExportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + var response = _redisRedisResourcesRestClient.ExportData(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new RedisArmOperation(_redisRedisResourcesClientDiagnostics, Pipeline, _redisRedisResourcesRestClient.CreateExportDataRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -1272,12 +1272,12 @@ public virtual ArmOperation ExportData(WaitUntil waitUntil, ExportRDBContent con /// The cancellation token to use. public virtual async Task> FlushCacheAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.FlushCache"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.FlushCache"); scope.Start(); try { - var response = await _redisResourceRestClient.FlushCacheAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new RedisArmOperation(new OperationStatusResultOperationSource(), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateFlushCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _redisRedisResourcesRestClient.FlushCacheAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new RedisArmOperation(new OperationStatusResultOperationSource(), _redisRedisResourcesClientDiagnostics, Pipeline, _redisRedisResourcesRestClient.CreateFlushCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -1314,12 +1314,12 @@ public virtual async Task> FlushCacheAsync(W /// The cancellation token to use. public virtual ArmOperation FlushCache(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.FlushCache"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.FlushCache"); scope.Start(); try { - var response = _redisResourceRestClient.FlushCache(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new RedisArmOperation(new OperationStatusResultOperationSource(), _redisResourceClientDiagnostics, Pipeline, _redisResourceRestClient.CreateFlushCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _redisRedisResourcesRestClient.FlushCache(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new RedisArmOperation(new OperationStatusResultOperationSource(), _redisRedisResourcesClientDiagnostics, Pipeline, _redisRedisResourcesRestClient.CreateFlushCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -1353,12 +1353,12 @@ public virtual ArmOperation FlushCache(WaitUntil waitUnti /// /// /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable ListByRedisCacheAsync(CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable ListByRedisCacheAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _redisResourceRestClient.CreateListByRedisCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisResourceRestClient.CreateListByRedisCacheNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => RedisPrivateLinkResourceData.DeserializeRedisPrivateLinkResourceData(e), _redisResourceClientDiagnostics, Pipeline, "RedisResource.ListByRedisCache", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisRedisResourcesRestClient.CreateListByRedisCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisRedisResourcesRestClient.CreateListByRedisCacheNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => RedisPrivateLinkResource.DeserializeRedisPrivateLinkResource(e), _redisRedisResourcesClientDiagnostics, Pipeline, "RedisResource.ListByRedisCache", "value", "nextLink", cancellationToken); } /// @@ -1383,12 +1383,12 @@ public virtual AsyncPageable ListByRedisCacheAsync /// /// /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable ListByRedisCache(CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable ListByRedisCache(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _redisResourceRestClient.CreateListByRedisCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisResourceRestClient.CreateListByRedisCacheNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => RedisPrivateLinkResourceData.DeserializeRedisPrivateLinkResourceData(e), _redisResourceClientDiagnostics, Pipeline, "RedisResource.ListByRedisCache", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _redisRedisResourcesRestClient.CreateListByRedisCacheRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _redisRedisResourcesRestClient.CreateListByRedisCacheNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => RedisPrivateLinkResource.DeserializeRedisPrivateLinkResource(e), _redisRedisResourcesClientDiagnostics, Pipeline, "RedisResource.ListByRedisCache", "value", "nextLink", cancellationToken); } /// @@ -1421,7 +1421,7 @@ public virtual async Task> AddTagAsync(string key, strin Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.AddTag"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.AddTag"); scope.Start(); try { @@ -1430,7 +1430,7 @@ public virtual async Task> AddTagAsync(string key, strin var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues[key] = value; await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _redisResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var originalResponse = await _redisRedisResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return Response.FromValue(new RedisResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else @@ -1483,7 +1483,7 @@ public virtual Response AddTag(string key, string value, Cancella Argument.AssertNotNull(key, nameof(key)); Argument.AssertNotNull(value, nameof(value)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.AddTag"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.AddTag"); scope.Start(); try { @@ -1492,7 +1492,7 @@ public virtual Response AddTag(string key, string value, Cancella var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues[key] = value; GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _redisResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var originalResponse = _redisRedisResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return Response.FromValue(new RedisResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else @@ -1543,7 +1543,7 @@ public virtual async Task> SetTagsAsync(IDictionary> SetTagsAsync(IDictionary SetTags(IDictionary tags, { Argument.AssertNotNull(tags, nameof(tags)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.SetTags"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.SetTags"); scope.Start(); try { @@ -1610,7 +1610,7 @@ public virtual Response SetTags(IDictionary tags, var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.ReplaceWith(tags); GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _redisResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var originalResponse = _redisRedisResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return Response.FromValue(new RedisResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else @@ -1657,7 +1657,7 @@ public virtual async Task> RemoveTagAsync(string key, Ca { Argument.AssertNotNull(key, nameof(key)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.RemoveTag"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.RemoveTag"); scope.Start(); try { @@ -1666,7 +1666,7 @@ public virtual async Task> RemoveTagAsync(string key, Ca var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); originalTags.Value.Data.TagValues.Remove(key); await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); - var originalResponse = await _redisResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var originalResponse = await _redisRedisResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); return Response.FromValue(new RedisResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else @@ -1717,7 +1717,7 @@ public virtual Response RemoveTag(string key, CancellationToken c { Argument.AssertNotNull(key, nameof(key)); - using var scope = _redisResourceClientDiagnostics.CreateScope("RedisResource.RemoveTag"); + using var scope = _redisRedisResourcesClientDiagnostics.CreateScope("RedisResource.RemoveTag"); scope.Start(); try { @@ -1726,7 +1726,7 @@ public virtual Response RemoveTag(string key, CancellationToken c var originalTags = GetTagResource().Get(cancellationToken); originalTags.Value.Data.TagValues.Remove(key); GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); - var originalResponse = _redisResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var originalResponse = _redisRedisResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); return Response.FromValue(new RedisResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); } else diff --git a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/OperationsRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/OperationsRestOperations.cs deleted file mode 100644 index 22141e6b26f7..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/OperationsRestOperations.cs +++ /dev/null @@ -1,173 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.Redis.Models; - -namespace Azure.ResourceManager.Redis -{ - internal partial class OperationsRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of OperationsRestOperations. - /// The HTTP pipeline for sending and receiving REST requests and responses. - /// The application id to use for user agent. - /// Service host. - /// The API version to use for this operation. - /// or is null. - public OperationsRestOperations(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 ?? "2024-11-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri() - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Cache/operations", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendPath("/providers/Microsoft.Cache/operations", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List the operations for the provider. - /// The cancellation token to use. - public async Task> ListAsync(CancellationToken cancellationToken = default) - { - using var message = CreateListRequest(); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OperationListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OperationListResult.DeserializeOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List the operations for the provider. - /// The cancellation token to use. - public Response List(CancellationToken cancellationToken = default) - { - using var message = CreateListRequest(); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OperationListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OperationListResult.DeserializeOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(string nextLink) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List the operations for the provider. - /// The URL to the next page of results. - /// The cancellation token to use. - /// is null. - public async Task> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - - using var message = CreateListNextPageRequest(nextLink); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OperationListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = OperationListResult.DeserializeOperationListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List the operations for the provider. - /// The URL to the next page of results. - /// The cancellation token to use. - /// is null. - public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - - using var message = CreateListNextPageRequest(nextLink); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OperationListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = OperationListResult.DeserializeOperationListResult(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/RedisResourcesRestOperations.cs b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisResourcesRestOperations.cs index e1b4db129bc7..6658ae2b39ef 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisResourcesRestOperations.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/src/Generated/RestOperations/RedisResourcesRestOperations.cs @@ -77,7 +77,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task> GetAsync(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -89,13 +89,13 @@ public async Task> GetAsync(string subscriptionId, s { case 200: { - RedisResourceData value = default; + RedisData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = RedisResourceData.DeserializeRedisResourceData(document.RootElement); + value = RedisData.DeserializeRedisData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((RedisResourceData)null, message.Response); + return Response.FromValue((RedisData)null, message.Response); default: throw new RequestFailedException(message.Response); } @@ -108,7 +108,7 @@ public async Task> GetAsync(string subscriptionId, s /// The cancellation token to use. /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Get(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -120,19 +120,19 @@ public Response Get(string subscriptionId, string resourceGro { case 200: { - RedisResourceData value = default; + RedisData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = RedisResourceData.DeserializeRedisResourceData(document.RootElement); + value = RedisData.DeserializeRedisData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((RedisResourceData)null, message.Response); + return Response.FromValue((RedisData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string name, RedisResourceCreateOrUpdateContent content) + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string name, RedisCreateOrUpdateContent content) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -146,7 +146,7 @@ internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string name, RedisResourceCreateOrUpdateContent content) + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string name, RedisCreateOrUpdateContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -178,7 +178,7 @@ internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceG /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task CreateAsync(string subscriptionId, string resourceGroupName, string name, RedisResourceCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string name, RedisCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -205,7 +205,7 @@ public async Task CreateAsync(string subscriptionId, string resourceGr /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string name, RedisResourceCreateOrUpdateContent content, CancellationToken cancellationToken = default) + public Response Create(string subscriptionId, string resourceGroupName, string name, RedisCreateOrUpdateContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -961,7 +961,7 @@ public Response ForceReboot(string subscriptionId, strin } } - internal RequestUriBuilder CreateImportDataRequestUri(string subscriptionId, string resourceGroupName, string name, ImportRDBContent content) + internal RequestUriBuilder CreateImportDataRequestUri(string subscriptionId, string resourceGroupName, string name, ImportRdbContent content) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -976,7 +976,7 @@ internal RequestUriBuilder CreateImportDataRequestUri(string subscriptionId, str return uri; } - internal HttpMessage CreateImportDataRequest(string subscriptionId, string resourceGroupName, string name, ImportRDBContent content) + internal HttpMessage CreateImportDataRequest(string subscriptionId, string resourceGroupName, string name, ImportRdbContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1008,7 +1008,7 @@ internal HttpMessage CreateImportDataRequest(string subscriptionId, string resou /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task ImportDataAsync(string subscriptionId, string resourceGroupName, string name, ImportRDBContent content, CancellationToken cancellationToken = default) + public async Task ImportDataAsync(string subscriptionId, string resourceGroupName, string name, ImportRdbContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -1036,7 +1036,7 @@ public async Task ImportDataAsync(string subscriptionId, string resour /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ImportData(string subscriptionId, string resourceGroupName, string name, ImportRDBContent content, CancellationToken cancellationToken = default) + public Response ImportData(string subscriptionId, string resourceGroupName, string name, ImportRdbContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -1056,7 +1056,7 @@ public Response ImportData(string subscriptionId, string resourceGroupName, stri } } - internal RequestUriBuilder CreateExportDataRequestUri(string subscriptionId, string resourceGroupName, string name, ExportRDBContent content) + internal RequestUriBuilder CreateExportDataRequestUri(string subscriptionId, string resourceGroupName, string name, ExportRdbContent content) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -1071,7 +1071,7 @@ internal RequestUriBuilder CreateExportDataRequestUri(string subscriptionId, str return uri; } - internal HttpMessage CreateExportDataRequest(string subscriptionId, string resourceGroupName, string name, ExportRDBContent content) + internal HttpMessage CreateExportDataRequest(string subscriptionId, string resourceGroupName, string name, ExportRdbContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -1103,7 +1103,7 @@ internal HttpMessage CreateExportDataRequest(string subscriptionId, string resou /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task ExportDataAsync(string subscriptionId, string resourceGroupName, string name, ExportRDBContent content, CancellationToken cancellationToken = default) + public async Task ExportDataAsync(string subscriptionId, string resourceGroupName, string name, ExportRdbContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -1131,7 +1131,7 @@ public async Task ExportDataAsync(string subscriptionId, string resour /// The cancellation token to use. /// , , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response ExportData(string subscriptionId, string resourceGroupName, string name, ExportRDBContent content, CancellationToken cancellationToken = default) + public Response ExportData(string subscriptionId, string resourceGroupName, string name, ExportRdbContent content, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs index 412f641ca7c2..d30adee4b529 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisLinkedServerWithPropertyCollection.cs @@ -34,10 +34,10 @@ public async Task CreateOrUpdate_LinkedServerCreate() string resourceGroupName = "rg1"; string name = "cache1"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redisResource = client.GetRedisResource(redisResourceId); + RedisResource redis = client.GetRedisResource(redisResourceId); // get the collection of this RedisLinkedServerWithPropertyResource - RedisLinkedServerWithPropertyCollection collection = redisResource.GetRedisLinkedServerWithProperties(); + RedisLinkedServerWithPropertyCollection collection = redis.GetRedisLinkedServerWithProperties(); // invoke the operation string linkedServerName = "cache2"; @@ -70,10 +70,10 @@ public async Task Get_LinkedServerGet() string resourceGroupName = "rg1"; string name = "cache1"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redisResource = client.GetRedisResource(redisResourceId); + RedisResource redis = client.GetRedisResource(redisResourceId); // get the collection of this RedisLinkedServerWithPropertyResource - RedisLinkedServerWithPropertyCollection collection = redisResource.GetRedisLinkedServerWithProperties(); + RedisLinkedServerWithPropertyCollection collection = redis.GetRedisLinkedServerWithProperties(); // invoke the operation string linkedServerName = "cache2"; @@ -104,10 +104,10 @@ public async Task GetAll_LinkedServerList() string resourceGroupName = "rg1"; string name = "cache1"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redisResource = client.GetRedisResource(redisResourceId); + RedisResource redis = client.GetRedisResource(redisResourceId); // get the collection of this RedisLinkedServerWithPropertyResource - RedisLinkedServerWithPropertyCollection collection = redisResource.GetRedisLinkedServerWithProperties(); + RedisLinkedServerWithPropertyCollection collection = redis.GetRedisLinkedServerWithProperties(); // invoke the operation and iterate over the result await foreach (RedisLinkedServerWithPropertyResource item in collection.GetAllAsync()) @@ -140,10 +140,10 @@ public async Task Exists_LinkedServerGet() string resourceGroupName = "rg1"; string name = "cache1"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redisResource = client.GetRedisResource(redisResourceId); + RedisResource redis = client.GetRedisResource(redisResourceId); // get the collection of this RedisLinkedServerWithPropertyResource - RedisLinkedServerWithPropertyCollection collection = redisResource.GetRedisLinkedServerWithProperties(); + RedisLinkedServerWithPropertyCollection collection = redis.GetRedisLinkedServerWithProperties(); // invoke the operation string linkedServerName = "cache2"; @@ -170,10 +170,10 @@ public async Task GetIfExists_LinkedServerGet() string resourceGroupName = "rg1"; string name = "cache1"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); - RedisResource redisResource = client.GetRedisResource(redisResourceId); + RedisResource redis = client.GetRedisResource(redisResourceId); // get the collection of this RedisLinkedServerWithPropertyResource - RedisLinkedServerWithPropertyCollection collection = redisResource.GetRedisLinkedServerWithProperties(); + RedisLinkedServerWithPropertyCollection collection = redis.GetRedisLinkedServerWithProperties(); // invoke the operation string linkedServerName = "cache2"; diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs index 5d64f0d17858..69644379394e 100644 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs +++ b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_RedisPrivateEndpointConnectionCollection.cs @@ -33,10 +33,10 @@ public async Task CreateOrUpdate_RedisCachePutPrivateEndpointConnection() string resourceGroupName = "rgtest01"; string cacheName = "cachetest01"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); - RedisResource redisResource = client.GetRedisResource(redisResourceId); + RedisResource redis = client.GetRedisResource(redisResourceId); // get the collection of this RedisPrivateEndpointConnectionResource - RedisPrivateEndpointConnectionCollection collection = redisResource.GetRedisPrivateEndpointConnections(); + RedisPrivateEndpointConnectionCollection collection = redis.GetRedisPrivateEndpointConnections(); // invoke the operation string privateEndpointConnectionName = "pectest01"; @@ -69,10 +69,10 @@ public async Task Get_RedisCacheGetPrivateEndpointConnection() string resourceGroupName = "rgtest01"; string cacheName = "cachetest01"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); - RedisResource redisResource = client.GetRedisResource(redisResourceId); + RedisResource redis = client.GetRedisResource(redisResourceId); // get the collection of this RedisPrivateEndpointConnectionResource - RedisPrivateEndpointConnectionCollection collection = redisResource.GetRedisPrivateEndpointConnections(); + RedisPrivateEndpointConnectionCollection collection = redis.GetRedisPrivateEndpointConnections(); // invoke the operation string privateEndpointConnectionName = "pectest01"; @@ -103,10 +103,10 @@ public async Task GetAll_RedisCacheListPrivateEndpointConnection() string resourceGroupName = "rgtest01"; string cacheName = "cachetest01"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); - RedisResource redisResource = client.GetRedisResource(redisResourceId); + RedisResource redis = client.GetRedisResource(redisResourceId); // get the collection of this RedisPrivateEndpointConnectionResource - RedisPrivateEndpointConnectionCollection collection = redisResource.GetRedisPrivateEndpointConnections(); + RedisPrivateEndpointConnectionCollection collection = redis.GetRedisPrivateEndpointConnections(); // invoke the operation and iterate over the result await foreach (RedisPrivateEndpointConnectionResource item in collection.GetAllAsync()) @@ -139,10 +139,10 @@ public async Task Exists_RedisCacheGetPrivateEndpointConnection() string resourceGroupName = "rgtest01"; string cacheName = "cachetest01"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); - RedisResource redisResource = client.GetRedisResource(redisResourceId); + RedisResource redis = client.GetRedisResource(redisResourceId); // get the collection of this RedisPrivateEndpointConnectionResource - RedisPrivateEndpointConnectionCollection collection = redisResource.GetRedisPrivateEndpointConnections(); + RedisPrivateEndpointConnectionCollection collection = redis.GetRedisPrivateEndpointConnections(); // invoke the operation string privateEndpointConnectionName = "pectest01"; @@ -169,10 +169,10 @@ public async Task GetIfExists_RedisCacheGetPrivateEndpointConnection() string resourceGroupName = "rgtest01"; string cacheName = "cachetest01"; ResourceIdentifier redisResourceId = RedisResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, cacheName); - RedisResource redisResource = client.GetRedisResource(redisResourceId); + RedisResource redis = client.GetRedisResource(redisResourceId); // get the collection of this RedisPrivateEndpointConnectionResource - RedisPrivateEndpointConnectionCollection collection = redisResource.GetRedisPrivateEndpointConnections(); + RedisPrivateEndpointConnectionCollection collection = redis.GetRedisPrivateEndpointConnections(); // invoke the operation string privateEndpointConnectionName = "pectest01"; diff --git a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_TenantResourceExtensions.cs b/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_TenantResourceExtensions.cs deleted file mode 100644 index 02c84c0a6c15..000000000000 --- a/sdk/redis/Azure.ResourceManager.Redis/tests/Generated/Samples/Sample_TenantResourceExtensions.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Threading.Tasks; -using Azure.Core; -using Azure.Identity; -using Azure.ResourceManager.Redis.Models; -using Azure.ResourceManager.Resources; -using NUnit.Framework; - -namespace Azure.ResourceManager.Redis.Samples -{ - public partial class Sample_TenantResourceExtensions - { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task List_RedisCacheOperations() - { - // Generated from example definition: 2024-11-01/RedisCacheOperations.json - // this example is just showing the usage of "Operations_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); - - TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; - - // invoke the operation and iterate over the result - await foreach (Models.Operation item in tenantResource.ListAsync()) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine("Succeeded"); - } - } -} From 5e98e0a46c882913b14dea50e8098f46052623c2 Mon Sep 17 00:00:00 2001 From: Wei Hu Date: Wed, 27 Aug 2025 14:03:13 +0800 Subject: [PATCH 4/4] save inputs --- .../Azure.ResourceManager.Redis/Configuration.json | 14 ++++++++++++++ .../tsp-location.yaml.bak | 3 +++ 2 files changed, 17 insertions(+) create mode 100644 sdk/redis/Azure.ResourceManager.Redis/Configuration.json create mode 100644 sdk/redis/Azure.ResourceManager.Redis/tsp-location.yaml.bak diff --git a/sdk/redis/Azure.ResourceManager.Redis/Configuration.json b/sdk/redis/Azure.ResourceManager.Redis/Configuration.json new file mode 100644 index 000000000000..bcc76dd3cbe6 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/Configuration.json @@ -0,0 +1,14 @@ +{ + "output-folder": ".", + "namespace": "Azure.ResourceManager.Redis", + "library-name": "Azure.ResourceManager.Redis", + "flavor": "azure", + "use-model-reader-writer": true, + "shared-source-folders": [ + "../../TempTypeSpecFiles/node_modules/@autorest/csharp/Generator.Shared", + "../../TempTypeSpecFiles/node_modules/@autorest/csharp/Azure.Core.Shared" + ], + "model-namespace": true, + "enable-bicep-serialization": true, + "azure-arm": true +} diff --git a/sdk/redis/Azure.ResourceManager.Redis/tsp-location.yaml.bak b/sdk/redis/Azure.ResourceManager.Redis/tsp-location.yaml.bak new file mode 100644 index 000000000000..d22247904107 --- /dev/null +++ b/sdk/redis/Azure.ResourceManager.Redis/tsp-location.yaml.bak @@ -0,0 +1,3 @@ +directory: specification/redis/Cache.Management +commit: 8aba41a76f3278396f07647ace4af85e4c461f80 +repo: Azure/azure-rest-api-specs \ No newline at end of file