internal static QueueServiceData DeserializeQueueServiceData(JsonElement element) { ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; Optional <CorsRules> cors = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id")) { id = new ResourceIdentifier(property.Value.GetString()); continue; } if (property.NameEquals("name")) { name = property.Value.GetString(); continue; } if (property.NameEquals("type")) { type = new ResourceType(property.Value.GetString()); continue; } if (property.NameEquals("systemData")) { systemData = JsonSerializer.Deserialize <SystemData>(property.Value.ToString()); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("cors")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } cors = CorsRules.DeserializeCorsRules(property0.Value); continue; } } continue; } } return(new QueueServiceData(id, name, type, systemData, cors.Value)); }
internal static BlobServiceData DeserializeBlobServiceData(JsonElement element) { Optional <Sku> sku = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional <CorsRules> cors = default; Optional <string> defaultServiceVersion = default; Optional <DeleteRetentionPolicy> deleteRetentionPolicy = default; Optional <bool> isVersioningEnabled = default; Optional <bool> automaticSnapshotPolicyEnabled = default; Optional <ChangeFeed> changeFeed = default; Optional <RestorePolicyProperties> restorePolicy = default; Optional <DeleteRetentionPolicy> containerDeleteRetentionPolicy = default; Optional <LastAccessTimeTrackingPolicy> lastAccessTimeTrackingPolicy = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sku = Sku.DeserializeSku(property.Value); continue; } if (property.NameEquals("id")) { id = new ResourceIdentifier(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")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("cors")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } cors = CorsRules.DeserializeCorsRules(property0.Value); continue; } if (property0.NameEquals("defaultServiceVersion")) { defaultServiceVersion = property0.Value.GetString(); continue; } if (property0.NameEquals("deleteRetentionPolicy")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } deleteRetentionPolicy = DeleteRetentionPolicy.DeserializeDeleteRetentionPolicy(property0.Value); continue; } if (property0.NameEquals("isVersioningEnabled")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } isVersioningEnabled = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("automaticSnapshotPolicyEnabled")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } automaticSnapshotPolicyEnabled = property0.Value.GetBoolean(); continue; } if (property0.NameEquals("changeFeed")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } changeFeed = ChangeFeed.DeserializeChangeFeed(property0.Value); continue; } if (property0.NameEquals("restorePolicy")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } restorePolicy = RestorePolicyProperties.DeserializeRestorePolicyProperties(property0.Value); continue; } if (property0.NameEquals("containerDeleteRetentionPolicy")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } containerDeleteRetentionPolicy = DeleteRetentionPolicy.DeserializeDeleteRetentionPolicy(property0.Value); continue; } if (property0.NameEquals("lastAccessTimeTrackingPolicy")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } lastAccessTimeTrackingPolicy = LastAccessTimeTrackingPolicy.DeserializeLastAccessTimeTrackingPolicy(property0.Value); continue; } } continue; } } return(new BlobServiceData(id, name, type, sku.Value, cors.Value, defaultServiceVersion.Value, deleteRetentionPolicy.Value, Optional.ToNullable(isVersioningEnabled), Optional.ToNullable(automaticSnapshotPolicyEnabled), changeFeed.Value, restorePolicy.Value, containerDeleteRetentionPolicy.Value, lastAccessTimeTrackingPolicy.Value)); }
internal static FileServiceData DeserializeFileServiceData(JsonElement element) { Optional <Sku> sku = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional <CorsRules> cors = default; Optional <DeleteRetentionPolicy> shareDeleteRetentionPolicy = default; Optional <ProtocolSettings> protocolSettings = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sku")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sku = Sku.DeserializeSku(property.Value); continue; } if (property.NameEquals("id")) { id = new ResourceIdentifier(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")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } foreach (var property0 in property.Value.EnumerateObject()) { if (property0.NameEquals("cors")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } cors = CorsRules.DeserializeCorsRules(property0.Value); continue; } if (property0.NameEquals("shareDeleteRetentionPolicy")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } shareDeleteRetentionPolicy = DeleteRetentionPolicy.DeserializeDeleteRetentionPolicy(property0.Value); continue; } if (property0.NameEquals("protocolSettings")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } protocolSettings = ProtocolSettings.DeserializeProtocolSettings(property0.Value); continue; } } continue; } } return(new FileServiceData(id, name, type, sku.Value, cors.Value, shareDeleteRetentionPolicy.Value, protocolSettings.Value)); }