예제 #1
0
        internal static GatewayOperatorProperties DeserializeGatewayOperatorProperties(JsonElement element)
        {
            Optional <GatewayOperatorResourceRequests>  resourceRequests = default;
            Optional <IReadOnlyList <GatewayInstance> > instances        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("resourceRequests"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    resourceRequests = GatewayOperatorResourceRequests.DeserializeGatewayOperatorResourceRequests(property.Value);
                    continue;
                }
                if (property.NameEquals("instances"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <GatewayInstance> array = new List <GatewayInstance>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(GatewayInstance.DeserializeGatewayInstance(item));
                    }
                    instances = array;
                    continue;
                }
            }
            return(new GatewayOperatorProperties(resourceRequests.Value, Optional.ToList(instances)));
        }
예제 #2
0
 internal GatewayOperatorProperties(GatewayOperatorResourceRequests resourceRequests, IReadOnlyList <GatewayInstance> instances)
 {
     ResourceRequests = resourceRequests;
     Instances        = instances;
 }