internal static BlobContainer DeserializeBlobContainer(JsonElement element) { string etag = default; string id = default; string name = default; string type = default; string version = default; bool? deleted = default; DateTimeOffset?deletedTime = default; int? remainingRetentionDays = default; string defaultEncryptionScope = default; bool? denyEncryptionScopeOverride = default; PublicAccess? publicAccess = default; DateTimeOffset?lastModifiedTime = default; LeaseStatus? leaseStatus = default; LeaseState? leaseState = default; LeaseDuration? leaseDuration = default; IDictionary <string, string> metadata = default; ImmutabilityPolicyProperties immutabilityPolicy = default; LegalHoldProperties legalHold = default; bool?hasLegalHold = default; bool?hasImmutabilityPolicy = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } etag = property.Value.GetString(); continue; } if (property.NameEquals("id")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } id = property.Value.GetString(); continue; } if (property.NameEquals("name")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } type = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("version")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } version = property0.Value.GetString(); continue; } if (property0.NameEquals("deleted")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } deleted = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("deletedTime")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } deletedTime = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("remainingRetentionDays")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } remainingRetentionDays = property0.Value.GetInt32(); continue; } if (property0.NameEquals("defaultEncryptionScope")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } defaultEncryptionScope = property0.Value.GetString(); continue; } if (property0.NameEquals("denyEncryptionScopeOverride")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } denyEncryptionScopeOverride = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("publicAccess")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } publicAccess = property0.Value.GetString().ToPublicAccess(); continue; } if (property0.NameEquals("lastModifiedTime")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } lastModifiedTime = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("leaseStatus")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } leaseStatus = new LeaseStatus(property0.Value.GetString()); continue; } if (property0.NameEquals("leaseState")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } leaseState = new LeaseState(property0.Value.GetString()); continue; } if (property0.NameEquals("leaseDuration")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } leaseDuration = new LeaseDuration(property0.Value.GetString()); continue; } if (property0.NameEquals("metadata")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property1 in property0.Value.EnumerateObject()) { if (property1.Value.ValueKind == JsonValueKind.Null) { dictionary.Add(property1.Name, null); } else { dictionary.Add(property1.Name, property1.Value.GetString()); } } metadata = dictionary; continue; } if (property0.NameEquals("immutabilityPolicy")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } immutabilityPolicy = ImmutabilityPolicyProperties.DeserializeImmutabilityPolicyProperties(property0.Value); continue; } if (property0.NameEquals("legalHold")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } legalHold = LegalHoldProperties.DeserializeLegalHoldProperties(property0.Value); continue; } if (property0.NameEquals("hasLegalHold")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } hasLegalHold = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("hasImmutabilityPolicy")) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } hasImmutabilityPolicy = property0.Value.GetBoolean(); continue; } } continue; } } return(new BlobContainer(id, name, type, etag, version, deleted, deletedTime, remainingRetentionDays, defaultEncryptionScope, denyEncryptionScopeOverride, publicAccess, lastModifiedTime, leaseStatus, leaseState, leaseDuration, metadata, immutabilityPolicy, legalHold, hasLegalHold, hasImmutabilityPolicy)); }
internal static BlobContainer DeserializeBlobContainer(JsonElement element) { Optional <string> etag = default; Optional <string> id = default; Optional <string> name = default; Optional <string> type = default; Optional <string> version = default; Optional <bool> deleted = default; Optional <DateTimeOffset> deletedTime = default; Optional <int> remainingRetentionDays = default; Optional <string> defaultEncryptionScope = default; Optional <bool> denyEncryptionScopeOverride = default; Optional <PublicAccess> publicAccess = default; Optional <DateTimeOffset> lastModifiedTime = default; Optional <LeaseStatus> leaseStatus = default; Optional <LeaseState> leaseState = default; Optional <LeaseDuration> leaseDuration = default; Optional <IDictionary <string, string> > metadata = default; Optional <ImmutabilityPolicyProperties> immutabilityPolicy = default; Optional <LegalHoldProperties> legalHold = default; Optional <bool> hasLegalHold = default; Optional <bool> hasImmutabilityPolicy = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag")) { etag = property.Value.GetString(); continue; } if (property.NameEquals("id")) { id = property.Value.GetString(); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = property.Value.GetString(); continue; } if (property.NameEquals("properties")) { foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("version")) { version = property0.Value.GetString(); continue; } if (property0.NameEquals("deleted")) { deleted = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("deletedTime")) { deletedTime = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("remainingRetentionDays")) { remainingRetentionDays = property0.Value.GetInt32(); continue; } if (property0.NameEquals("defaultEncryptionScope")) { defaultEncryptionScope = property0.Value.GetString(); continue; } if (property0.NameEquals("denyEncryptionScopeOverride")) { denyEncryptionScopeOverride = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("publicAccess")) { publicAccess = property0.Value.GetString().ToPublicAccess(); continue; } if (property0.NameEquals("lastModifiedTime")) { lastModifiedTime = property0.Value.GetDateTimeOffset("O"); continue; } if (property0.NameEquals("leaseStatus")) { leaseStatus = new LeaseStatus(property0.Value.GetString()); continue; } if (property0.NameEquals("leaseState")) { leaseState = new LeaseState(property0.Value.GetString()); continue; } if (property0.NameEquals("leaseDuration")) { leaseDuration = new LeaseDuration(property0.Value.GetString()); continue; } if (property0.NameEquals("metadata")) { Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property1 in property0.Value.EnumerateObject()) { dictionary.Add(property1.Name, property1.Value.GetString()); } metadata = dictionary; continue; } if (property0.NameEquals("immutabilityPolicy")) { immutabilityPolicy = ImmutabilityPolicyProperties.DeserializeImmutabilityPolicyProperties(property0.Value); continue; } if (property0.NameEquals("legalHold")) { legalHold = LegalHoldProperties.DeserializeLegalHoldProperties(property0.Value); continue; } if (property0.NameEquals("hasLegalHold")) { hasLegalHold = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("hasImmutabilityPolicy")) { hasImmutabilityPolicy = property0.Value.GetBoolean(); continue; } } continue; } } return(new BlobContainer(id.Value, name.Value, type.Value, etag.Value, version.Value, Optional.ToNullable(deleted), Optional.ToNullable(deletedTime), Optional.ToNullable(remainingRetentionDays), defaultEncryptionScope.Value, Optional.ToNullable(denyEncryptionScopeOverride), Optional.ToNullable(publicAccess), Optional.ToNullable(lastModifiedTime), Optional.ToNullable(leaseStatus), Optional.ToNullable(leaseState), Optional.ToNullable(leaseDuration), Optional.ToDictionary(metadata), immutabilityPolicy.Value, legalHold.Value, Optional.ToNullable(hasLegalHold), Optional.ToNullable(hasImmutabilityPolicy))); }