internal static CapacityReservationInstanceView DeserializeCapacityReservationInstanceView(JsonElement element)
        {
            Optional <CapacityReservationUtilization>      utilizationInfo = default;
            Optional <IReadOnlyList <InstanceViewStatus> > statuses        = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("utilizationInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    utilizationInfo = CapacityReservationUtilization.DeserializeCapacityReservationUtilization(property.Value);
                    continue;
                }
                if (property.NameEquals("statuses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <InstanceViewStatus> array = new List <InstanceViewStatus>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(InstanceViewStatus.DeserializeInstanceViewStatus(item));
                    }
                    statuses = array;
                    continue;
                }
            }
            return(new CapacityReservationInstanceView(utilizationInfo.Value, Optional.ToList(statuses)));
        }
Пример #2
0
 internal CapacityReservationInstanceView(CapacityReservationUtilization utilizationInfo, IReadOnlyList <InstanceViewStatus> statuses)
 {
     UtilizationInfo = utilizationInfo;
     Statuses        = statuses;
 }
Пример #3
0
 internal CapacityReservationInstanceViewWithName(CapacityReservationUtilization utilizationInfo, IReadOnlyList <InstanceViewStatus> statuses, string name) : base(utilizationInfo, statuses)
 {
     Name = name;
 }