示例#1
0
 internal TaskContainerSettings(string containerRunOptions, string imageName, ContainerRegistry registry, ContainerWorkingDirectory?workingDirectory)
 {
     ContainerRunOptions = containerRunOptions;
     ImageName           = imageName;
     Registry            = registry;
     WorkingDirectory    = workingDirectory;
 }
示例#2
0
        internal static TaskContainerSettings DeserializeTaskContainerSettings(JsonElement element)
        {
            string                    containerRunOptions = default;
            string                    imageName           = default;
            ContainerRegistry         registry            = default;
            ContainerWorkingDirectory?workingDirectory    = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("containerRunOptions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    containerRunOptions = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("imageName"))
                {
                    imageName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("registry"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    registry = ContainerRegistry.DeserializeContainerRegistry(property.Value);
                    continue;
                }
                if (property.NameEquals("workingDirectory"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    workingDirectory = property.Value.GetString().ToContainerWorkingDirectory();
                    continue;
                }
            }
            return(new TaskContainerSettings(containerRunOptions, imageName, registry, workingDirectory));
        }