1
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
2
// Licensed under the MIT License.
3
3
4
- // <auto-generated/>
5
-
6
4
#nullable disable
7
5
8
6
using System ;
9
- using System . Globalization ;
10
7
using System . Collections . Generic ;
8
+ using System . Globalization ;
11
9
using System . Text . Json ;
12
10
using Azure . Core ;
13
11
14
- // This customization can be removed after fix https://github.com/Azure/autorest.csharp/issues/2745
15
- [ assembly: CodeGenSuppressType ( "RedisCommonConfiguration" ) ]
16
-
17
12
namespace Azure . ResourceManager . Redis . Models
18
13
{
19
14
public partial class RedisCommonConfiguration : IUtf8JsonSerializable
20
15
{
21
- void IUtf8JsonSerializable . Write ( Utf8JsonWriter writer )
16
+ void global :: Azure . Core . IUtf8JsonSerializable . Write ( Utf8JsonWriter writer )
22
17
{
23
18
writer . WriteStartObject ( ) ;
24
19
if ( Optional . IsDefined ( IsRdbBackupEnabled ) )
25
20
{
26
- writer . WritePropertyName ( "rdb-backup-enabled" ) ;
21
+ writer . WritePropertyName ( "rdb-backup-enabled"u8 ) ;
27
22
writer . WriteBooleanValue ( IsRdbBackupEnabled . Value ) ;
28
23
}
29
24
if ( Optional . IsDefined ( RdbBackupFrequency ) )
30
25
{
31
- writer . WritePropertyName ( "rdb-backup-frequency" ) ;
26
+ writer . WritePropertyName ( "rdb-backup-frequency"u8 ) ;
32
27
writer . WriteStringValue ( RdbBackupFrequency ) ;
33
28
}
34
29
if ( Optional . IsDefined ( RdbBackupMaxSnapshotCount ) )
35
30
{
36
- writer . WritePropertyName ( "rdb-backup-max-snapshot-count" ) ;
31
+ writer . WritePropertyName ( "rdb-backup-max-snapshot-count"u8 ) ;
37
32
writer . WriteStringValue ( RdbBackupMaxSnapshotCount . Value . ToString ( CultureInfo . InvariantCulture ) ) ;
38
33
}
39
34
if ( Optional . IsDefined ( RdbStorageConnectionString ) )
40
35
{
41
- writer . WritePropertyName ( "rdb-storage-connection-string" ) ;
36
+ writer . WritePropertyName ( "rdb-storage-connection-string"u8 ) ;
42
37
writer . WriteStringValue ( RdbStorageConnectionString ) ;
43
38
}
44
39
if ( Optional . IsDefined ( IsAofBackupEnabled ) )
45
40
{
46
- writer . WritePropertyName ( "aof-backup-enabled" ) ;
41
+ writer . WritePropertyName ( "aof-backup-enabled"u8 ) ;
47
42
writer . WriteBooleanValue ( IsAofBackupEnabled . Value ) ;
48
43
}
49
44
if ( Optional . IsDefined ( AofStorageConnectionString0 ) )
50
45
{
51
- writer . WritePropertyName ( "aof-storage-connection-string-0" ) ;
46
+ writer . WritePropertyName ( "aof-storage-connection-string-0"u8 ) ;
52
47
writer . WriteStringValue ( AofStorageConnectionString0 ) ;
53
48
}
54
49
if ( Optional . IsDefined ( AofStorageConnectionString1 ) )
55
50
{
56
- writer . WritePropertyName ( "aof-storage-connection-string-1" ) ;
51
+ writer . WritePropertyName ( "aof-storage-connection-string-1"u8 ) ;
57
52
writer . WriteStringValue ( AofStorageConnectionString1 ) ;
58
53
}
59
54
if ( Optional . IsDefined ( MaxFragmentationMemoryReserved ) )
60
55
{
61
- writer . WritePropertyName ( "maxfragmentationmemory-reserved" ) ;
56
+ writer . WritePropertyName ( "maxfragmentationmemory-reserved"u8 ) ;
62
57
writer . WriteStringValue ( MaxFragmentationMemoryReserved ) ;
63
58
}
64
59
if ( Optional . IsDefined ( MaxMemoryPolicy ) )
65
60
{
66
- writer . WritePropertyName ( "maxmemory-policy" ) ;
61
+ writer . WritePropertyName ( "maxmemory-policy"u8 ) ;
67
62
writer . WriteStringValue ( MaxMemoryPolicy ) ;
68
63
}
69
64
if ( Optional . IsDefined ( MaxMemoryReserved ) )
70
65
{
71
- writer . WritePropertyName ( "maxmemory-reserved" ) ;
66
+ writer . WritePropertyName ( "maxmemory-reserved"u8 ) ;
72
67
writer . WriteStringValue ( MaxMemoryReserved ) ;
73
68
}
74
69
if ( Optional . IsDefined ( MaxMemoryDelta ) )
75
70
{
76
- writer . WritePropertyName ( "maxmemory-delta" ) ;
71
+ writer . WritePropertyName ( "maxmemory-delta"u8 ) ;
77
72
writer . WriteStringValue ( MaxMemoryDelta ) ;
78
73
}
74
+ if ( Optional . IsDefined ( PreferredDataPersistenceAuthMethod ) )
75
+ {
76
+ writer . WritePropertyName ( "preferred-data-persistence-auth-method"u8 ) ;
77
+ writer . WriteStringValue ( PreferredDataPersistenceAuthMethod ) ;
78
+ }
79
79
if ( Optional . IsDefined ( AuthNotRequired ) )
80
80
{
81
- writer . WritePropertyName ( "authnotrequired" ) ;
81
+ writer . WritePropertyName ( "authnotrequired"u8 ) ;
82
82
writer . WriteStringValue ( AuthNotRequired ) ;
83
83
}
84
84
foreach ( var item in AdditionalProperties )
@@ -95,6 +95,10 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
95
95
96
96
internal static RedisCommonConfiguration DeserializeRedisCommonConfiguration ( JsonElement element )
97
97
{
98
+ if ( element . ValueKind == JsonValueKind . Null )
99
+ {
100
+ return null ;
101
+ }
98
102
Optional < bool > rdbBackupEnabled = default ;
99
103
Optional < string > rdbBackupFrequency = default ;
100
104
Optional < int > rdbBackupMaxSnapshotCount = default ;
@@ -115,11 +119,10 @@ internal static RedisCommonConfiguration DeserializeRedisCommonConfiguration(Jso
115
119
Dictionary < string , BinaryData > additionalPropertiesDictionary = new Dictionary < string , BinaryData > ( ) ;
116
120
foreach ( var property in element . EnumerateObject ( ) )
117
121
{
118
- if ( property . NameEquals ( "rdb-backup-enabled" ) )
122
+ if ( property . NameEquals ( "rdb-backup-enabled"u8 ) )
119
123
{
120
124
if ( property . Value . ValueKind == JsonValueKind . Null )
121
125
{
122
- property . ThrowNonNullablePropertyIsNull ( ) ;
123
126
continue ;
124
127
}
125
128
@@ -129,35 +132,33 @@ internal static RedisCommonConfiguration DeserializeRedisCommonConfiguration(Jso
129
132
130
133
continue ;
131
134
}
132
- if ( property . NameEquals ( "rdb-backup-frequency" ) )
135
+ if ( property . NameEquals ( "rdb-backup-frequency"u8 ) )
133
136
{
134
137
rdbBackupFrequency = property . Value . GetString ( ) ;
135
138
continue ;
136
139
}
137
- if ( property . NameEquals ( "rdb-backup-max-snapshot-count" ) )
140
+ if ( property . NameEquals ( "rdb-backup-max-snapshot-count"u8 ) )
138
141
{
139
142
if ( property . Value . ValueKind == JsonValueKind . Null )
140
143
{
141
- property . ThrowNonNullablePropertyIsNull ( ) ;
142
144
continue ;
143
145
}
144
146
if ( ! int . TryParse ( property . Value . GetString ( ) , out int rdbBackupMaxSnapshotCountValue ) )
145
147
{
146
- throw new FormatException ( ) ;
148
+ throw new FormatException ( $ "cannot parse { property . Value . GetString ( ) } into an int for property { property . Name } " ) ;
147
149
}
148
150
rdbBackupMaxSnapshotCount = rdbBackupMaxSnapshotCountValue ;
149
151
continue ;
150
152
}
151
- if ( property . NameEquals ( "rdb-storage-connection-string" ) )
153
+ if ( property . NameEquals ( "rdb-storage-connection-string"u8 ) )
152
154
{
153
155
rdbStorageConnectionString = property . Value . GetString ( ) ;
154
156
continue ;
155
157
}
156
- if ( property . NameEquals ( "aof-backup-enabled" ) )
158
+ if ( property . NameEquals ( "aof-backup-enabled"u8 ) )
157
159
{
158
160
if ( property . Value . ValueKind == JsonValueKind . Null )
159
161
{
160
- property . ThrowNonNullablePropertyIsNull ( ) ;
161
162
continue ;
162
163
}
163
164
@@ -167,57 +168,57 @@ internal static RedisCommonConfiguration DeserializeRedisCommonConfiguration(Jso
167
168
168
169
continue ;
169
170
}
170
- if ( property . NameEquals ( "aof-storage-connection-string-0" ) )
171
+ if ( property . NameEquals ( "aof-storage-connection-string-0"u8 ) )
171
172
{
172
173
aofStorageConnectionString0 = property . Value . GetString ( ) ;
173
174
continue ;
174
175
}
175
- if ( property . NameEquals ( "aof-storage-connection-string-1" ) )
176
+ if ( property . NameEquals ( "aof-storage-connection-string-1"u8 ) )
176
177
{
177
178
aofStorageConnectionString1 = property . Value . GetString ( ) ;
178
179
continue ;
179
180
}
180
- if ( property . NameEquals ( "maxfragmentationmemory-reserved" ) )
181
+ if ( property . NameEquals ( "maxfragmentationmemory-reserved"u8 ) )
181
182
{
182
183
maxfragmentationmemoryReserved = property . Value . GetString ( ) ;
183
184
continue ;
184
185
}
185
- if ( property . NameEquals ( "maxmemory-policy" ) )
186
+ if ( property . NameEquals ( "maxmemory-policy"u8 ) )
186
187
{
187
188
maxmemoryPolicy = property . Value . GetString ( ) ;
188
189
continue ;
189
190
}
190
- if ( property . NameEquals ( "maxmemory-reserved" ) )
191
+ if ( property . NameEquals ( "maxmemory-reserved"u8 ) )
191
192
{
192
193
maxmemoryReserved = property . Value . GetString ( ) ;
193
194
continue ;
194
195
}
195
- if ( property . NameEquals ( "maxmemory-delta" ) )
196
+ if ( property . NameEquals ( "maxmemory-delta"u8 ) )
196
197
{
197
198
maxmemoryDelta = property . Value . GetString ( ) ;
198
199
continue ;
199
200
}
200
- if ( property . NameEquals ( "maxclients" ) )
201
+ if ( property . NameEquals ( "maxclients"u8 ) )
201
202
{
202
203
maxclients = property . Value . GetString ( ) ;
203
204
continue ;
204
205
}
205
- if ( property . NameEquals ( "preferred-data-archive-auth-method" ) )
206
+ if ( property . NameEquals ( "preferred-data-archive-auth-method"u8 ) )
206
207
{
207
208
preferredDataArchiveAuthMethod = property . Value . GetString ( ) ;
208
209
continue ;
209
210
}
210
- if ( property . NameEquals ( "preferred-data-persistence-auth-method" ) )
211
+ if ( property . NameEquals ( "preferred-data-persistence-auth-method"u8 ) )
211
212
{
212
213
preferredDataPersistenceAuthMethod = property . Value . GetString ( ) ;
213
214
continue ;
214
215
}
215
- if ( property . NameEquals ( "zonal-configuration" ) )
216
+ if ( property . NameEquals ( "zonal-configuration"u8 ) )
216
217
{
217
218
zonalConfiguration = property . Value . GetString ( ) ;
218
219
continue ;
219
220
}
220
- if ( property . NameEquals ( "authnotrequired" ) )
221
+ if ( property . NameEquals ( "authnotrequired"u8 ) )
221
222
{
222
223
authnotrequired = property . Value . GetString ( ) ;
223
224
continue ;
0 commit comments