11// Copyright (c) Microsoft Corporation. All rights reserved.
22// Licensed under the MIT License.
33
4- // <auto-generated/>
5-
64#nullable disable
75
86using System ;
9- using System . Globalization ;
107using System . Collections . Generic ;
8+ using System . Globalization ;
119using System . Text . Json ;
1210using Azure . Core ;
1311
14- // This customization can be removed after fix https://github.com/Azure/autorest.csharp/issues/2745
15- [ assembly: CodeGenSuppressType ( "RedisCommonConfiguration" ) ]
16-
1712namespace Azure . ResourceManager . Redis . Models
1813{
1914 public partial class RedisCommonConfiguration : IUtf8JsonSerializable
2015 {
21- void IUtf8JsonSerializable . Write ( Utf8JsonWriter writer )
16+ void global :: Azure . Core . IUtf8JsonSerializable . Write ( Utf8JsonWriter writer )
2217 {
2318 writer . WriteStartObject ( ) ;
2419 if ( Optional . IsDefined ( IsRdbBackupEnabled ) )
2520 {
26- writer . WritePropertyName ( "rdb-backup-enabled" ) ;
21+ writer . WritePropertyName ( "rdb-backup-enabled"u8 ) ;
2722 writer . WriteBooleanValue ( IsRdbBackupEnabled . Value ) ;
2823 }
2924 if ( Optional . IsDefined ( RdbBackupFrequency ) )
3025 {
31- writer . WritePropertyName ( "rdb-backup-frequency" ) ;
26+ writer . WritePropertyName ( "rdb-backup-frequency"u8 ) ;
3227 writer . WriteStringValue ( RdbBackupFrequency ) ;
3328 }
3429 if ( Optional . IsDefined ( RdbBackupMaxSnapshotCount ) )
3530 {
36- writer . WritePropertyName ( "rdb-backup-max-snapshot-count" ) ;
31+ writer . WritePropertyName ( "rdb-backup-max-snapshot-count"u8 ) ;
3732 writer . WriteStringValue ( RdbBackupMaxSnapshotCount . Value . ToString ( CultureInfo . InvariantCulture ) ) ;
3833 }
3934 if ( Optional . IsDefined ( RdbStorageConnectionString ) )
4035 {
41- writer . WritePropertyName ( "rdb-storage-connection-string" ) ;
36+ writer . WritePropertyName ( "rdb-storage-connection-string"u8 ) ;
4237 writer . WriteStringValue ( RdbStorageConnectionString ) ;
4338 }
4439 if ( Optional . IsDefined ( IsAofBackupEnabled ) )
4540 {
46- writer . WritePropertyName ( "aof-backup-enabled" ) ;
41+ writer . WritePropertyName ( "aof-backup-enabled"u8 ) ;
4742 writer . WriteBooleanValue ( IsAofBackupEnabled . Value ) ;
4843 }
4944 if ( Optional . IsDefined ( AofStorageConnectionString0 ) )
5045 {
51- writer . WritePropertyName ( "aof-storage-connection-string-0" ) ;
46+ writer . WritePropertyName ( "aof-storage-connection-string-0"u8 ) ;
5247 writer . WriteStringValue ( AofStorageConnectionString0 ) ;
5348 }
5449 if ( Optional . IsDefined ( AofStorageConnectionString1 ) )
5550 {
56- writer . WritePropertyName ( "aof-storage-connection-string-1" ) ;
51+ writer . WritePropertyName ( "aof-storage-connection-string-1"u8 ) ;
5752 writer . WriteStringValue ( AofStorageConnectionString1 ) ;
5853 }
5954 if ( Optional . IsDefined ( MaxFragmentationMemoryReserved ) )
6055 {
61- writer . WritePropertyName ( "maxfragmentationmemory-reserved" ) ;
56+ writer . WritePropertyName ( "maxfragmentationmemory-reserved"u8 ) ;
6257 writer . WriteStringValue ( MaxFragmentationMemoryReserved ) ;
6358 }
6459 if ( Optional . IsDefined ( MaxMemoryPolicy ) )
6560 {
66- writer . WritePropertyName ( "maxmemory-policy" ) ;
61+ writer . WritePropertyName ( "maxmemory-policy"u8 ) ;
6762 writer . WriteStringValue ( MaxMemoryPolicy ) ;
6863 }
6964 if ( Optional . IsDefined ( MaxMemoryReserved ) )
7065 {
71- writer . WritePropertyName ( "maxmemory-reserved" ) ;
66+ writer . WritePropertyName ( "maxmemory-reserved"u8 ) ;
7267 writer . WriteStringValue ( MaxMemoryReserved ) ;
7368 }
7469 if ( Optional . IsDefined ( MaxMemoryDelta ) )
7570 {
76- writer . WritePropertyName ( "maxmemory-delta" ) ;
71+ writer . WritePropertyName ( "maxmemory-delta"u8 ) ;
7772 writer . WriteStringValue ( MaxMemoryDelta ) ;
7873 }
74+ if ( Optional . IsDefined ( PreferredDataPersistenceAuthMethod ) )
75+ {
76+ writer . WritePropertyName ( "preferred-data-persistence-auth-method"u8 ) ;
77+ writer . WriteStringValue ( PreferredDataPersistenceAuthMethod ) ;
78+ }
7979 if ( Optional . IsDefined ( AuthNotRequired ) )
8080 {
81- writer . WritePropertyName ( "authnotrequired" ) ;
81+ writer . WritePropertyName ( "authnotrequired"u8 ) ;
8282 writer . WriteStringValue ( AuthNotRequired ) ;
8383 }
8484 foreach ( var item in AdditionalProperties )
@@ -95,6 +95,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
9595
9696 internal static RedisCommonConfiguration DeserializeRedisCommonConfiguration ( JsonElement element )
9797 {
98+ if ( element . ValueKind == JsonValueKind . Null )
99+ {
100+ return null ;
101+ }
98102 Optional < bool > rdbBackupEnabled = default ;
99103 Optional < string > rdbBackupFrequency = default ;
100104 Optional < int > rdbBackupMaxSnapshotCount = default ;
@@ -115,11 +119,10 @@ internal static RedisCommonConfiguration DeserializeRedisCommonConfiguration(Jso
115119 Dictionary < string , BinaryData > additionalPropertiesDictionary = new Dictionary < string , BinaryData > ( ) ;
116120 foreach ( var property in element . EnumerateObject ( ) )
117121 {
118- if ( property . NameEquals ( "rdb-backup-enabled" ) )
122+ if ( property . NameEquals ( "rdb-backup-enabled"u8 ) )
119123 {
120124 if ( property . Value . ValueKind == JsonValueKind . Null )
121125 {
122- property . ThrowNonNullablePropertyIsNull ( ) ;
123126 continue ;
124127 }
125128
@@ -129,35 +132,33 @@ internal static RedisCommonConfiguration DeserializeRedisCommonConfiguration(Jso
129132
130133 continue ;
131134 }
132- if ( property . NameEquals ( "rdb-backup-frequency" ) )
135+ if ( property . NameEquals ( "rdb-backup-frequency"u8 ) )
133136 {
134137 rdbBackupFrequency = property . Value . GetString ( ) ;
135138 continue ;
136139 }
137- if ( property . NameEquals ( "rdb-backup-max-snapshot-count" ) )
140+ if ( property . NameEquals ( "rdb-backup-max-snapshot-count"u8 ) )
138141 {
139142 if ( property . Value . ValueKind == JsonValueKind . Null )
140143 {
141- property . ThrowNonNullablePropertyIsNull ( ) ;
142144 continue ;
143145 }
144146 if ( ! int . TryParse ( property . Value . GetString ( ) , out int rdbBackupMaxSnapshotCountValue ) )
145147 {
146- throw new FormatException ( ) ;
148+ throw new FormatException ( $ "cannot parse { property . Value . GetString ( ) } into an int for property { property . Name } " ) ;
147149 }
148150 rdbBackupMaxSnapshotCount = rdbBackupMaxSnapshotCountValue ;
149151 continue ;
150152 }
151- if ( property . NameEquals ( "rdb-storage-connection-string" ) )
153+ if ( property . NameEquals ( "rdb-storage-connection-string"u8 ) )
152154 {
153155 rdbStorageConnectionString = property . Value . GetString ( ) ;
154156 continue ;
155157 }
156- if ( property . NameEquals ( "aof-backup-enabled" ) )
158+ if ( property . NameEquals ( "aof-backup-enabled"u8 ) )
157159 {
158160 if ( property . Value . ValueKind == JsonValueKind . Null )
159161 {
160- property . ThrowNonNullablePropertyIsNull ( ) ;
161162 continue ;
162163 }
163164
@@ -167,57 +168,57 @@ internal static RedisCommonConfiguration DeserializeRedisCommonConfiguration(Jso
167168
168169 continue ;
169170 }
170- if ( property . NameEquals ( "aof-storage-connection-string-0" ) )
171+ if ( property . NameEquals ( "aof-storage-connection-string-0"u8 ) )
171172 {
172173 aofStorageConnectionString0 = property . Value . GetString ( ) ;
173174 continue ;
174175 }
175- if ( property . NameEquals ( "aof-storage-connection-string-1" ) )
176+ if ( property . NameEquals ( "aof-storage-connection-string-1"u8 ) )
176177 {
177178 aofStorageConnectionString1 = property . Value . GetString ( ) ;
178179 continue ;
179180 }
180- if ( property . NameEquals ( "maxfragmentationmemory-reserved" ) )
181+ if ( property . NameEquals ( "maxfragmentationmemory-reserved"u8 ) )
181182 {
182183 maxfragmentationmemoryReserved = property . Value . GetString ( ) ;
183184 continue ;
184185 }
185- if ( property . NameEquals ( "maxmemory-policy" ) )
186+ if ( property . NameEquals ( "maxmemory-policy"u8 ) )
186187 {
187188 maxmemoryPolicy = property . Value . GetString ( ) ;
188189 continue ;
189190 }
190- if ( property . NameEquals ( "maxmemory-reserved" ) )
191+ if ( property . NameEquals ( "maxmemory-reserved"u8 ) )
191192 {
192193 maxmemoryReserved = property . Value . GetString ( ) ;
193194 continue ;
194195 }
195- if ( property . NameEquals ( "maxmemory-delta" ) )
196+ if ( property . NameEquals ( "maxmemory-delta"u8 ) )
196197 {
197198 maxmemoryDelta = property . Value . GetString ( ) ;
198199 continue ;
199200 }
200- if ( property . NameEquals ( "maxclients" ) )
201+ if ( property . NameEquals ( "maxclients"u8 ) )
201202 {
202203 maxclients = property . Value . GetString ( ) ;
203204 continue ;
204205 }
205- if ( property . NameEquals ( "preferred-data-archive-auth-method" ) )
206+ if ( property . NameEquals ( "preferred-data-archive-auth-method"u8 ) )
206207 {
207208 preferredDataArchiveAuthMethod = property . Value . GetString ( ) ;
208209 continue ;
209210 }
210- if ( property . NameEquals ( "preferred-data-persistence-auth-method" ) )
211+ if ( property . NameEquals ( "preferred-data-persistence-auth-method"u8 ) )
211212 {
212213 preferredDataPersistenceAuthMethod = property . Value . GetString ( ) ;
213214 continue ;
214215 }
215- if ( property . NameEquals ( "zonal-configuration" ) )
216+ if ( property . NameEquals ( "zonal-configuration"u8 ) )
216217 {
217218 zonalConfiguration = property . Value . GetString ( ) ;
218219 continue ;
219220 }
220- if ( property . NameEquals ( "authnotrequired" ) )
221+ if ( property . NameEquals ( "authnotrequired"u8 ) )
221222 {
222223 authnotrequired = property . Value . GetString ( ) ;
223224 continue ;
0 commit comments