| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | // <auto-generated/> |
| | 5 | |
|
| | 6 | | #nullable disable |
| | 7 | |
|
| | 8 | | using System; |
| | 9 | | using System.Collections.Generic; |
| | 10 | | using System.Text.Json; |
| | 11 | | using Azure.Core; |
| | 12 | |
|
| | 13 | | namespace Azure.ResourceManager.Storage.Models |
| | 14 | | { |
| | 15 | | public partial class ListContainerItem : IUtf8JsonSerializable |
| | 16 | | { |
| | 17 | | void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) |
| | 18 | | { |
| 0 | 19 | | writer.WriteStartObject(); |
| 0 | 20 | | if (Etag != null) |
| | 21 | | { |
| 0 | 22 | | writer.WritePropertyName("etag"); |
| 0 | 23 | | writer.WriteStringValue(Etag); |
| | 24 | | } |
| 0 | 25 | | if (Id != null) |
| | 26 | | { |
| 0 | 27 | | writer.WritePropertyName("id"); |
| 0 | 28 | | writer.WriteStringValue(Id); |
| | 29 | | } |
| 0 | 30 | | if (Name != null) |
| | 31 | | { |
| 0 | 32 | | writer.WritePropertyName("name"); |
| 0 | 33 | | writer.WriteStringValue(Name); |
| | 34 | | } |
| 0 | 35 | | if (Type != null) |
| | 36 | | { |
| 0 | 37 | | writer.WritePropertyName("type"); |
| 0 | 38 | | writer.WriteStringValue(Type); |
| | 39 | | } |
| 0 | 40 | | writer.WritePropertyName("properties"); |
| 0 | 41 | | writer.WriteStartObject(); |
| 0 | 42 | | if (Version != null) |
| | 43 | | { |
| 0 | 44 | | writer.WritePropertyName("version"); |
| 0 | 45 | | writer.WriteStringValue(Version); |
| | 46 | | } |
| 0 | 47 | | if (Deleted != null) |
| | 48 | | { |
| 0 | 49 | | writer.WritePropertyName("deleted"); |
| 0 | 50 | | writer.WriteBooleanValue(Deleted.Value); |
| | 51 | | } |
| 0 | 52 | | if (DeletedTime != null) |
| | 53 | | { |
| 0 | 54 | | writer.WritePropertyName("deletedTime"); |
| 0 | 55 | | writer.WriteStringValue(DeletedTime.Value, "O"); |
| | 56 | | } |
| 0 | 57 | | if (RemainingRetentionDays != null) |
| | 58 | | { |
| 0 | 59 | | writer.WritePropertyName("remainingRetentionDays"); |
| 0 | 60 | | writer.WriteNumberValue(RemainingRetentionDays.Value); |
| | 61 | | } |
| 0 | 62 | | if (DefaultEncryptionScope != null) |
| | 63 | | { |
| 0 | 64 | | writer.WritePropertyName("defaultEncryptionScope"); |
| 0 | 65 | | writer.WriteStringValue(DefaultEncryptionScope); |
| | 66 | | } |
| 0 | 67 | | if (DenyEncryptionScopeOverride != null) |
| | 68 | | { |
| 0 | 69 | | writer.WritePropertyName("denyEncryptionScopeOverride"); |
| 0 | 70 | | writer.WriteBooleanValue(DenyEncryptionScopeOverride.Value); |
| | 71 | | } |
| 0 | 72 | | if (PublicAccess != null) |
| | 73 | | { |
| 0 | 74 | | writer.WritePropertyName("publicAccess"); |
| 0 | 75 | | writer.WriteStringValue(PublicAccess.Value.ToSerialString()); |
| | 76 | | } |
| 0 | 77 | | if (LastModifiedTime != null) |
| | 78 | | { |
| 0 | 79 | | writer.WritePropertyName("lastModifiedTime"); |
| 0 | 80 | | writer.WriteStringValue(LastModifiedTime.Value, "O"); |
| | 81 | | } |
| 0 | 82 | | if (LeaseStatus != null) |
| | 83 | | { |
| 0 | 84 | | writer.WritePropertyName("leaseStatus"); |
| 0 | 85 | | writer.WriteStringValue(LeaseStatus.Value.ToString()); |
| | 86 | | } |
| 0 | 87 | | if (LeaseState != null) |
| | 88 | | { |
| 0 | 89 | | writer.WritePropertyName("leaseState"); |
| 0 | 90 | | writer.WriteStringValue(LeaseState.Value.ToString()); |
| | 91 | | } |
| 0 | 92 | | if (LeaseDuration != null) |
| | 93 | | { |
| 0 | 94 | | writer.WritePropertyName("leaseDuration"); |
| 0 | 95 | | writer.WriteStringValue(LeaseDuration.Value.ToString()); |
| | 96 | | } |
| 0 | 97 | | if (Metadata != null) |
| | 98 | | { |
| 0 | 99 | | writer.WritePropertyName("metadata"); |
| 0 | 100 | | writer.WriteStartObject(); |
| 0 | 101 | | foreach (var item in Metadata) |
| | 102 | | { |
| 0 | 103 | | writer.WritePropertyName(item.Key); |
| 0 | 104 | | writer.WriteStringValue(item.Value); |
| | 105 | | } |
| 0 | 106 | | writer.WriteEndObject(); |
| | 107 | | } |
| 0 | 108 | | if (ImmutabilityPolicy != null) |
| | 109 | | { |
| 0 | 110 | | writer.WritePropertyName("immutabilityPolicy"); |
| 0 | 111 | | writer.WriteObjectValue(ImmutabilityPolicy); |
| | 112 | | } |
| 0 | 113 | | if (LegalHold != null) |
| | 114 | | { |
| 0 | 115 | | writer.WritePropertyName("legalHold"); |
| 0 | 116 | | writer.WriteObjectValue(LegalHold); |
| | 117 | | } |
| 0 | 118 | | if (HasLegalHold != null) |
| | 119 | | { |
| 0 | 120 | | writer.WritePropertyName("hasLegalHold"); |
| 0 | 121 | | writer.WriteBooleanValue(HasLegalHold.Value); |
| | 122 | | } |
| 0 | 123 | | if (HasImmutabilityPolicy != null) |
| | 124 | | { |
| 0 | 125 | | writer.WritePropertyName("hasImmutabilityPolicy"); |
| 0 | 126 | | writer.WriteBooleanValue(HasImmutabilityPolicy.Value); |
| | 127 | | } |
| 0 | 128 | | writer.WriteEndObject(); |
| 0 | 129 | | writer.WriteEndObject(); |
| 0 | 130 | | } |
| | 131 | |
|
| | 132 | | internal static ListContainerItem DeserializeListContainerItem(JsonElement element) |
| | 133 | | { |
| 24 | 134 | | string etag = default; |
| 24 | 135 | | string id = default; |
| 24 | 136 | | string name = default; |
| 24 | 137 | | string type = default; |
| 24 | 138 | | string version = default; |
| 24 | 139 | | bool? deleted = default; |
| 24 | 140 | | DateTimeOffset? deletedTime = default; |
| 24 | 141 | | int? remainingRetentionDays = default; |
| 24 | 142 | | string defaultEncryptionScope = default; |
| 24 | 143 | | bool? denyEncryptionScopeOverride = default; |
| 24 | 144 | | PublicAccess? publicAccess = default; |
| 24 | 145 | | DateTimeOffset? lastModifiedTime = default; |
| 24 | 146 | | LeaseStatus? leaseStatus = default; |
| 24 | 147 | | LeaseState? leaseState = default; |
| 24 | 148 | | LeaseDuration? leaseDuration = default; |
| 24 | 149 | | IDictionary<string, string> metadata = default; |
| 24 | 150 | | ImmutabilityPolicyProperties immutabilityPolicy = default; |
| 24 | 151 | | LegalHoldProperties legalHold = default; |
| 24 | 152 | | bool? hasLegalHold = default; |
| 24 | 153 | | bool? hasImmutabilityPolicy = default; |
| 288 | 154 | | foreach (var property in element.EnumerateObject()) |
| | 155 | | { |
| 120 | 156 | | if (property.NameEquals("etag")) |
| | 157 | | { |
| 24 | 158 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 159 | | { |
| | 160 | | continue; |
| | 161 | | } |
| 24 | 162 | | etag = property.Value.GetString(); |
| 24 | 163 | | continue; |
| | 164 | | } |
| 96 | 165 | | if (property.NameEquals("id")) |
| | 166 | | { |
| 24 | 167 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 168 | | { |
| | 169 | | continue; |
| | 170 | | } |
| 24 | 171 | | id = property.Value.GetString(); |
| 24 | 172 | | continue; |
| | 173 | | } |
| 72 | 174 | | if (property.NameEquals("name")) |
| | 175 | | { |
| 24 | 176 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 177 | | { |
| | 178 | | continue; |
| | 179 | | } |
| 24 | 180 | | name = property.Value.GetString(); |
| 24 | 181 | | continue; |
| | 182 | | } |
| 48 | 183 | | if (property.NameEquals("type")) |
| | 184 | | { |
| 24 | 185 | | if (property.Value.ValueKind == JsonValueKind.Null) |
| | 186 | | { |
| | 187 | | continue; |
| | 188 | | } |
| 24 | 189 | | type = property.Value.GetString(); |
| 24 | 190 | | continue; |
| | 191 | | } |
| 24 | 192 | | if (property.NameEquals("properties")) |
| | 193 | | { |
| 528 | 194 | | foreach (var property0 in property.Value.EnumerateObject()) |
| | 195 | | { |
| 240 | 196 | | if (property0.NameEquals("version")) |
| | 197 | | { |
| 0 | 198 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 199 | | { |
| | 200 | | continue; |
| | 201 | | } |
| 0 | 202 | | version = property0.Value.GetString(); |
| 0 | 203 | | continue; |
| | 204 | | } |
| 240 | 205 | | if (property0.NameEquals("deleted")) |
| | 206 | | { |
| 24 | 207 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 208 | | { |
| | 209 | | continue; |
| | 210 | | } |
| 24 | 211 | | deleted = property0.Value.GetBoolean(); |
| 24 | 212 | | continue; |
| | 213 | | } |
| 216 | 214 | | if (property0.NameEquals("deletedTime")) |
| | 215 | | { |
| 0 | 216 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 217 | | { |
| | 218 | | continue; |
| | 219 | | } |
| 0 | 220 | | deletedTime = property0.Value.GetDateTimeOffset("O"); |
| 0 | 221 | | continue; |
| | 222 | | } |
| 216 | 223 | | if (property0.NameEquals("remainingRetentionDays")) |
| | 224 | | { |
| 24 | 225 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 226 | | { |
| | 227 | | continue; |
| | 228 | | } |
| 24 | 229 | | remainingRetentionDays = property0.Value.GetInt32(); |
| 24 | 230 | | continue; |
| | 231 | | } |
| 192 | 232 | | if (property0.NameEquals("defaultEncryptionScope")) |
| | 233 | | { |
| 24 | 234 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 235 | | { |
| | 236 | | continue; |
| | 237 | | } |
| 24 | 238 | | defaultEncryptionScope = property0.Value.GetString(); |
| 24 | 239 | | continue; |
| | 240 | | } |
| 168 | 241 | | if (property0.NameEquals("denyEncryptionScopeOverride")) |
| | 242 | | { |
| 24 | 243 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 244 | | { |
| | 245 | | continue; |
| | 246 | | } |
| 24 | 247 | | denyEncryptionScopeOverride = property0.Value.GetBoolean(); |
| 24 | 248 | | continue; |
| | 249 | | } |
| 144 | 250 | | if (property0.NameEquals("publicAccess")) |
| | 251 | | { |
| 24 | 252 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 253 | | { |
| | 254 | | continue; |
| | 255 | | } |
| 24 | 256 | | publicAccess = property0.Value.GetString().ToPublicAccess(); |
| 24 | 257 | | continue; |
| | 258 | | } |
| 120 | 259 | | if (property0.NameEquals("lastModifiedTime")) |
| | 260 | | { |
| 24 | 261 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 262 | | { |
| | 263 | | continue; |
| | 264 | | } |
| 24 | 265 | | lastModifiedTime = property0.Value.GetDateTimeOffset("O"); |
| 24 | 266 | | continue; |
| | 267 | | } |
| 96 | 268 | | if (property0.NameEquals("leaseStatus")) |
| | 269 | | { |
| 24 | 270 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 271 | | { |
| | 272 | | continue; |
| | 273 | | } |
| 24 | 274 | | leaseStatus = new LeaseStatus(property0.Value.GetString()); |
| 24 | 275 | | continue; |
| | 276 | | } |
| 72 | 277 | | if (property0.NameEquals("leaseState")) |
| | 278 | | { |
| 24 | 279 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 280 | | { |
| | 281 | | continue; |
| | 282 | | } |
| 24 | 283 | | leaseState = new LeaseState(property0.Value.GetString()); |
| 24 | 284 | | continue; |
| | 285 | | } |
| 48 | 286 | | if (property0.NameEquals("leaseDuration")) |
| | 287 | | { |
| 0 | 288 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 289 | | { |
| | 290 | | continue; |
| | 291 | | } |
| 0 | 292 | | leaseDuration = new LeaseDuration(property0.Value.GetString()); |
| 0 | 293 | | continue; |
| | 294 | | } |
| 48 | 295 | | if (property0.NameEquals("metadata")) |
| | 296 | | { |
| 0 | 297 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 298 | | { |
| | 299 | | continue; |
| | 300 | | } |
| 0 | 301 | | Dictionary<string, string> dictionary = new Dictionary<string, string>(); |
| 0 | 302 | | foreach (var property1 in property0.Value.EnumerateObject()) |
| | 303 | | { |
| 0 | 304 | | if (property1.Value.ValueKind == JsonValueKind.Null) |
| | 305 | | { |
| 0 | 306 | | dictionary.Add(property1.Name, null); |
| | 307 | | } |
| | 308 | | else |
| | 309 | | { |
| 0 | 310 | | dictionary.Add(property1.Name, property1.Value.GetString()); |
| | 311 | | } |
| | 312 | | } |
| 0 | 313 | | metadata = dictionary; |
| 0 | 314 | | continue; |
| | 315 | | } |
| 48 | 316 | | if (property0.NameEquals("immutabilityPolicy")) |
| | 317 | | { |
| 0 | 318 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 319 | | { |
| | 320 | | continue; |
| | 321 | | } |
| 0 | 322 | | immutabilityPolicy = ImmutabilityPolicyProperties.DeserializeImmutabilityPolicyProperties(pr |
| 0 | 323 | | continue; |
| | 324 | | } |
| 48 | 325 | | if (property0.NameEquals("legalHold")) |
| | 326 | | { |
| 0 | 327 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 328 | | { |
| | 329 | | continue; |
| | 330 | | } |
| 0 | 331 | | legalHold = LegalHoldProperties.DeserializeLegalHoldProperties(property0.Value); |
| 0 | 332 | | continue; |
| | 333 | | } |
| 48 | 334 | | if (property0.NameEquals("hasLegalHold")) |
| | 335 | | { |
| 24 | 336 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 337 | | { |
| | 338 | | continue; |
| | 339 | | } |
| 24 | 340 | | hasLegalHold = property0.Value.GetBoolean(); |
| 24 | 341 | | continue; |
| | 342 | | } |
| 24 | 343 | | if (property0.NameEquals("hasImmutabilityPolicy")) |
| | 344 | | { |
| 24 | 345 | | if (property0.Value.ValueKind == JsonValueKind.Null) |
| | 346 | | { |
| | 347 | | continue; |
| | 348 | | } |
| 24 | 349 | | hasImmutabilityPolicy = property0.Value.GetBoolean(); |
| | 350 | | continue; |
| | 351 | | } |
| | 352 | | } |
| | 353 | | continue; |
| | 354 | | } |
| | 355 | | } |
| 24 | 356 | | return new ListContainerItem(id, name, type, etag, version, deleted, deletedTime, remainingRetentionDays, de |
| | 357 | | } |
| | 358 | | } |
| | 359 | | } |