Beispiel #1
0
 internal ContainerAppTemplate(string revisionSuffix, IList <ContainerAppContainer> containers, ContainerAppScale scale, IList <ContainerAppVolume> volumes)
 {
     RevisionSuffix = revisionSuffix;
     Containers     = containers;
     Scale          = scale;
     Volumes        = volumes;
 }
Beispiel #2
0
        internal static ContainerAppTemplate DeserializeContainerAppTemplate(JsonElement element)
        {
            Optional <string> revisionSuffix = default;
            Optional <IList <ContainerAppContainer> > containers = default;
            Optional <ContainerAppScale>           scale         = default;
            Optional <IList <ContainerAppVolume> > volumes       = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("revisionSuffix"))
                {
                    revisionSuffix = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("containers"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ContainerAppContainer> array = new List <ContainerAppContainer>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ContainerAppContainer.DeserializeContainerAppContainer(item));
                    }
                    containers = array;
                    continue;
                }
                if (property.NameEquals("scale"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    scale = ContainerAppScale.DeserializeContainerAppScale(property.Value);
                    continue;
                }
                if (property.NameEquals("volumes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <ContainerAppVolume> array = new List <ContainerAppVolume>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ContainerAppVolume.DeserializeContainerAppVolume(item));
                    }
                    volumes = array;
                    continue;
                }
            }
            return(new ContainerAppTemplate(revisionSuffix.Value, Optional.ToList(containers), scale.Value, Optional.ToList(volumes)));
        }