Пример #1
0
        internal static RecommendedMachineConfiguration DeserializeRecommendedMachineConfiguration(JsonElement element)
        {
            ResourceRange vCPUs  = default;
            ResourceRange memory = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("vCPUs"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    vCPUs = ResourceRange.DeserializeResourceRange(property.Value);
                    continue;
                }
                if (property.NameEquals("memory"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    memory = ResourceRange.DeserializeResourceRange(property.Value);
                    continue;
                }
            }
            return(new RecommendedMachineConfiguration(vCPUs, memory));
        }
Пример #2
0
        internal static RecommendedMachineConfiguration DeserializeRecommendedMachineConfiguration(JsonElement element)
        {
            Optional <ResourceRange> vCPUs  = default;
            Optional <ResourceRange> memory = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("vCPUs"))
                {
                    vCPUs = ResourceRange.DeserializeResourceRange(property.Value);
                    continue;
                }
                if (property.NameEquals("memory"))
                {
                    memory = ResourceRange.DeserializeResourceRange(property.Value);
                    continue;
                }
            }
            return(new RecommendedMachineConfiguration(vCPUs.Value, memory.Value));
        }