Пример #1
0
        internal static ResourceRequirements DeserializeResourceRequirements(JsonElement element)
        {
            ResourceRequests          requests = default;
            Optional <ResourceLimits> limits   = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("requests"))
                {
                    requests = ResourceRequests.DeserializeResourceRequests(property.Value);
                    continue;
                }
                if (property.NameEquals("limits"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    limits = ResourceLimits.DeserializeResourceLimits(property.Value);
                    continue;
                }
            }
            return(new ResourceRequirements(requests, limits.Value));
        }
Пример #2
0
 internal ResourceRequirements(ResourceRequests requests, ResourceLimits limits)
 {
     Requests = requests;
     Limits   = limits;
 }