Ejemplo n.º 1
0
        internal static OSFamily DeserializeOSFamily(JsonElement element)
        {
            Optional <string>             location   = default;
            Optional <OSFamilyProperties> properties = 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("properties"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    properties = OSFamilyProperties.DeserializeOSFamilyProperties(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;
                }
            }
            return(new OSFamily(id, name, type, location.Value, properties.Value));
        }
Ejemplo n.º 2
0
 internal OSFamily(ResourceIdentifier id, string name, ResourceType type, string location, OSFamilyProperties properties) : base(id, name, type)
 {
     Location   = location;
     Properties = properties;
 }