Example #1
0
 internal CustomContainer(string server, string containerImage, IList <string> command, IList <string> args, ImageRegistryCredential imageRegistryCredential, string languageFramework)
 {
     Server                  = server;
     ContainerImage          = containerImage;
     Command                 = command;
     Args                    = args;
     ImageRegistryCredential = imageRegistryCredential;
     LanguageFramework       = languageFramework;
 }
Example #2
0
        internal static CustomContainer DeserializeCustomContainer(JsonElement element)
        {
            Optional <string>                  server                  = default;
            Optional <string>                  containerImage          = default;
            Optional <IList <string> >         command                 = default;
            Optional <IList <string> >         args                    = default;
            Optional <ImageRegistryCredential> imageRegistryCredential = default;
            Optional <string>                  languageFramework       = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("server"))
                {
                    server = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("containerImage"))
                {
                    containerImage = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("command"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    command = array;
                    continue;
                }
                if (property.NameEquals("args"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    args = array;
                    continue;
                }
                if (property.NameEquals("imageRegistryCredential"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    imageRegistryCredential = ImageRegistryCredential.DeserializeImageRegistryCredential(property.Value);
                    continue;
                }
                if (property.NameEquals("languageFramework"))
                {
                    languageFramework = property.Value.GetString();
                    continue;
                }
            }
            return(new CustomContainer(server.Value, containerImage.Value, Optional.ToList(command), Optional.ToList(args), imageRegistryCredential.Value, languageFramework.Value));
        }