internal static TrackedResource DeserializeTrackedResource(JsonElement element) { string location = default; Optional <IDictionary <string, string> > tags = default; Optional <SystemData> systemData = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { dictionary.Add(property0.Name, property0.Value.GetString()); } tags = dictionary; continue; } if (property.NameEquals("systemData")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } systemData = SystemData.DeserializeSystemData(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; } } return(new TrackedResource(id, name, type, systemData.Value, location, Optional.ToDictionary(tags))); }
internal static ProxyResource DeserializeProxyResource(JsonElement element) { Optional <SystemData> systemData = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("systemData")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } systemData = SystemData.DeserializeSystemData(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; } } return(new ProxyResource(id, name, type, systemData.Value)); }
internal static ManagedRuleSetDefinition DeserializeManagedRuleSetDefinition(JsonElement element) { Optional <Sku> sku = default; Optional <SystemData> systemData = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional <string> provisioningState = default; Optional <string> ruleSetType = default; Optional <string> ruleSetVersion = default; Optional <IReadOnlyList <ManagedRuleGroupDefinition> > ruleGroups = 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("systemData")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } systemData = SystemData.DeserializeSystemData(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("provisioningState")) { provisioningState = property0.Value.GetString(); continue; } if (property0.NameEquals("ruleSetType")) { ruleSetType = property0.Value.GetString(); continue; } if (property0.NameEquals("ruleSetVersion")) { ruleSetVersion = property0.Value.GetString(); continue; } if (property0.NameEquals("ruleGroups")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <ManagedRuleGroupDefinition> array = new List <ManagedRuleGroupDefinition>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(ManagedRuleGroupDefinition.DeserializeManagedRuleGroupDefinition(item)); } ruleGroups = array; continue; } } continue; } } return(new ManagedRuleSetDefinition(id, name, type, systemData.Value, sku.Value, provisioningState.Value, ruleSetType.Value, ruleSetVersion.Value, Optional.ToList(ruleGroups))); }
internal static EdgeNode DeserializeEdgeNode(JsonElement element) { Optional <SystemData> systemData = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; Optional <IList <IpAddressGroup> > ipAddressGroups = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("systemData")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } systemData = SystemData.DeserializeSystemData(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("ipAddressGroups")) { if (property0.Value.ValueKind == JsonValueKind.Null) { property0.ThrowNonNullablePropertyIsNull(); continue; } List <IpAddressGroup> array = new List <IpAddressGroup>(); foreach (var item in property0.Value.EnumerateArray()) { array.Add(IpAddressGroup.DeserializeIpAddressGroup(item)); } ipAddressGroups = array; continue; } } continue; } } return(new EdgeNode(id, name, type, systemData.Value, Optional.ToList(ipAddressGroups))); }