internal static GenericResource DeserializeGenericResource(JsonElement element) { Plan plan = default; object properties = default; string kind = default; string managedBy = default; Sku sku = default; Identity identity = default; string id = default; string name = default; string type = default; string location = default; IDictionary <string, string> tags = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("plan")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } plan = Plan.DeserializePlan(property.Value); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } properties = property.Value.GetObject(); continue; } if (property.NameEquals("kind")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } kind = property.Value.GetString(); continue; } if (property.NameEquals("managedBy")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } managedBy = property.Value.GetString(); continue; } if (property.NameEquals("sku")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } sku = Sku.DeserializeSku(property.Value); continue; } if (property.NameEquals("identity")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } identity = Identity.DeserializeIdentity(property.Value); 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("location")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } location = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } Dictionary <string, string> dictionary = new Dictionary <string, string>(); foreach (var property0 in property.Value.EnumerateObject()) { if (property0.Value.ValueKind == JsonValueKind.Null) { dictionary.Add(property0.Name, null); } else { dictionary.Add(property0.Name, property0.Value.GetString()); } } tags = dictionary; continue; } } return(new GenericResource(id, name, type, location, tags, plan, properties, kind, managedBy, sku, identity)); }
internal static GenericResource DeserializeGenericResource(JsonElement element) { Optional <Plan> plan = default; Optional <object> properties = default; Optional <string> kind = default; Optional <string> managedBy = default; Optional <Sku> sku = default; Optional <Identity> identity = default; Optional <string> id = default; Optional <string> name = default; Optional <string> type = default; Optional <string> location = default; Optional <IDictionary <string, string> > tags = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("plan")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } plan = Plan.DeserializePlan(property.Value); continue; } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } properties = property.Value.GetObject(); continue; } if (property.NameEquals("kind")) { kind = property.Value.GetString(); continue; } if (property.NameEquals("managedBy")) { managedBy = property.Value.GetString(); continue; } if (property.NameEquals("sku")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } sku = Sku.DeserializeSku(property.Value); continue; } if (property.NameEquals("identity")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } identity = Identity.DeserializeIdentity(property.Value); 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("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; } } return(new GenericResource(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), plan.Value, properties.Value, kind.Value, managedBy.Value, sku.Value, identity.Value)); }
internal static GenericResourceExpanded DeserializeGenericResourceExpanded(JsonElement element) { Optional <DateTimeOffset> createdTime = default; Optional <DateTimeOffset> changedTime = default; Optional <string> provisioningState = default; Optional <Plan> plan = default; Optional <object> properties = default; Optional <string> kind = default; Optional <string> managedBy = default; Optional <Sku> sku = default; Optional <Identity> identity = default; Optional <string> id = default; Optional <string> name = default; Optional <string> type = default; Optional <string> location = default; Optional <IDictionary <string, string> > tags = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("createdTime")) { createdTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("changedTime")) { changedTime = property.Value.GetDateTimeOffset("O"); continue; } if (property.NameEquals("provisioningState")) { provisioningState = property.Value.GetString(); continue; } if (property.NameEquals("plan")) { plan = Plan.DeserializePlan(property.Value); continue; } if (property.NameEquals("properties")) { properties = property.Value.GetObject(); continue; } if (property.NameEquals("kind")) { kind = property.Value.GetString(); continue; } if (property.NameEquals("managedBy")) { managedBy = property.Value.GetString(); continue; } if (property.NameEquals("sku")) { sku = Sku.DeserializeSku(property.Value); continue; } if (property.NameEquals("identity")) { identity = Identity.DeserializeIdentity(property.Value); 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("location")) { location = property.Value.GetString(); continue; } if (property.NameEquals("tags")) { 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; } } return(new GenericResourceExpanded(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), plan.Value, properties.Value, kind.Value, managedBy.Value, sku.Value, identity.Value, Optional.ToNullable(createdTime), Optional.ToNullable(changedTime), provisioningState.Value)); }