예제 #1
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"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    vCPUs = ResourceRange.DeserializeResourceRange(property.Value);
                    continue;
                }
                if (property.NameEquals("memory"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    memory = ResourceRange.DeserializeResourceRange(property.Value);
                    continue;
                }
            }
            return(new RecommendedMachineConfiguration(vCPUs.Value, memory.Value));
        }
예제 #2
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));
        }