internal static JobSpecification DeserializeJobSpecification(JsonElement element)
        {
            int?                       priority                  = default;
            string                     displayName               = default;
            bool?                      usesTaskDependencies      = default;
            OnAllTasksComplete?        onAllTasksComplete        = default;
            OnTaskFailure?             onTaskFailure             = default;
            JobNetworkConfiguration    networkConfiguration      = default;
            JobConstraints             constraints               = default;
            JobManagerTask             jobManagerTask            = default;
            JobPreparationTask         jobPreparationTask        = default;
            JobReleaseTask             jobReleaseTask            = default;
            IList <EnvironmentSetting> commonEnvironmentSettings = default;
            PoolInformation            poolInfo                  = default;
            IList <MetadataItem>       metadata                  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("priority"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    priority = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("displayName"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    displayName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("usesTaskDependencies"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    usesTaskDependencies = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("onAllTasksComplete"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    onAllTasksComplete = property.Value.GetString().ToOnAllTasksComplete();
                    continue;
                }
                if (property.NameEquals("onTaskFailure"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    onTaskFailure = property.Value.GetString().ToOnTaskFailure();
                    continue;
                }
                if (property.NameEquals("networkConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    networkConfiguration = JobNetworkConfiguration.DeserializeJobNetworkConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("constraints"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    constraints = JobConstraints.DeserializeJobConstraints(property.Value);
                    continue;
                }
                if (property.NameEquals("jobManagerTask"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    jobManagerTask = JobManagerTask.DeserializeJobManagerTask(property.Value);
                    continue;
                }
                if (property.NameEquals("jobPreparationTask"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    jobPreparationTask = JobPreparationTask.DeserializeJobPreparationTask(property.Value);
                    continue;
                }
                if (property.NameEquals("jobReleaseTask"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    jobReleaseTask = JobReleaseTask.DeserializeJobReleaseTask(property.Value);
                    continue;
                }
                if (property.NameEquals("commonEnvironmentSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <EnvironmentSetting> array = new List <EnvironmentSetting>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(EnvironmentSetting.DeserializeEnvironmentSetting(item));
                    }
                    commonEnvironmentSettings = array;
                    continue;
                }
                if (property.NameEquals("poolInfo"))
                {
                    poolInfo = PoolInformation.DeserializePoolInformation(property.Value);
                    continue;
                }
                if (property.NameEquals("metadata"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <MetadataItem> array = new List <MetadataItem>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(MetadataItem.DeserializeMetadataItem(item));
                    }
                    metadata = array;
                    continue;
                }
            }
            return(new JobSpecification(priority, displayName, usesTaskDependencies, onAllTasksComplete, onTaskFailure, networkConfiguration, constraints, jobManagerTask, jobPreparationTask, jobReleaseTask, commonEnvironmentSettings, poolInfo, metadata));
        }
        internal static JobReleaseTask DeserializeJobReleaseTask(JsonElement element)
        {
            string id          = default;
            string commandLine = default;
            TaskContainerSettings      containerSettings   = default;
            IList <ResourceFile>       resourceFiles       = default;
            IList <EnvironmentSetting> environmentSettings = default;
            TimeSpan?    maxWallClockTime = default;
            TimeSpan?    retentionTime    = default;
            UserIdentity userIdentity     = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("commandLine"))
                {
                    commandLine = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("containerSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    containerSettings = TaskContainerSettings.DeserializeTaskContainerSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("resourceFiles"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <ResourceFile> array = new List <ResourceFile>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ResourceFile.DeserializeResourceFile(item));
                    }
                    resourceFiles = array;
                    continue;
                }
                if (property.NameEquals("environmentSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <EnvironmentSetting> array = new List <EnvironmentSetting>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(EnvironmentSetting.DeserializeEnvironmentSetting(item));
                    }
                    environmentSettings = array;
                    continue;
                }
                if (property.NameEquals("maxWallClockTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    maxWallClockTime = property.Value.GetTimeSpan("P");
                    continue;
                }
                if (property.NameEquals("retentionTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    retentionTime = property.Value.GetTimeSpan("P");
                    continue;
                }
                if (property.NameEquals("userIdentity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    userIdentity = UserIdentity.DeserializeUserIdentity(property.Value);
                    continue;
                }
            }
            return(new JobReleaseTask(id, commandLine, containerSettings, resourceFiles, environmentSettings, maxWallClockTime, retentionTime, userIdentity));
        }
Пример #3
0
        internal static JobManagerTask DeserializeJobManagerTask(JsonElement element)
        {
            string id          = default;
            string displayName = default;
            string commandLine = default;
            TaskContainerSettings      containerSettings   = default;
            IList <ResourceFile>       resourceFiles       = default;
            IList <OutputFile>         outputFiles         = default;
            IList <EnvironmentSetting> environmentSettings = default;
            TaskConstraints            constraints         = default;
            bool?        killJobOnCompletion = default;
            UserIdentity userIdentity        = default;
            bool?        runExclusive        = default;
            IList <ApplicationPackageReference> applicationPackageReferences = default;
            AuthenticationTokenSettings         authenticationTokenSettings  = default;
            bool?allowLowPriorityNode = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("displayName"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    displayName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("commandLine"))
                {
                    commandLine = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("containerSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    containerSettings = TaskContainerSettings.DeserializeTaskContainerSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("resourceFiles"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <ResourceFile> array = new List <ResourceFile>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ResourceFile.DeserializeResourceFile(item));
                    }
                    resourceFiles = array;
                    continue;
                }
                if (property.NameEquals("outputFiles"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <OutputFile> array = new List <OutputFile>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(OutputFile.DeserializeOutputFile(item));
                    }
                    outputFiles = array;
                    continue;
                }
                if (property.NameEquals("environmentSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <EnvironmentSetting> array = new List <EnvironmentSetting>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(EnvironmentSetting.DeserializeEnvironmentSetting(item));
                    }
                    environmentSettings = array;
                    continue;
                }
                if (property.NameEquals("constraints"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    constraints = TaskConstraints.DeserializeTaskConstraints(property.Value);
                    continue;
                }
                if (property.NameEquals("killJobOnCompletion"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    killJobOnCompletion = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("userIdentity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    userIdentity = UserIdentity.DeserializeUserIdentity(property.Value);
                    continue;
                }
                if (property.NameEquals("runExclusive"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    runExclusive = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("applicationPackageReferences"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <ApplicationPackageReference> array = new List <ApplicationPackageReference>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ApplicationPackageReference.DeserializeApplicationPackageReference(item));
                    }
                    applicationPackageReferences = array;
                    continue;
                }
                if (property.NameEquals("authenticationTokenSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    authenticationTokenSettings = AuthenticationTokenSettings.DeserializeAuthenticationTokenSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("allowLowPriorityNode"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    allowLowPriorityNode = property.Value.GetBoolean();
                    continue;
                }
            }
            return(new JobManagerTask(id, displayName, commandLine, containerSettings, resourceFiles, outputFiles, environmentSettings, constraints, killJobOnCompletion, userIdentity, runExclusive, applicationPackageReferences, authenticationTokenSettings, allowLowPriorityNode));
        }
Пример #4
0
        internal static JobPreparationTask DeserializeJobPreparationTask(JsonElement element)
        {
            string id          = default;
            string commandLine = default;
            TaskContainerSettings      containerSettings   = default;
            IList <ResourceFile>       resourceFiles       = default;
            IList <EnvironmentSetting> environmentSettings = default;
            TaskConstraints            constraints         = default;
            bool?        waitForSuccess = default;
            UserIdentity userIdentity   = default;
            bool?        rerunOnNodeRebootAfterSuccess = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("commandLine"))
                {
                    commandLine = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("containerSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    containerSettings = TaskContainerSettings.DeserializeTaskContainerSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("resourceFiles"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <ResourceFile> array = new List <ResourceFile>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ResourceFile.DeserializeResourceFile(item));
                    }
                    resourceFiles = array;
                    continue;
                }
                if (property.NameEquals("environmentSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <EnvironmentSetting> array = new List <EnvironmentSetting>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(EnvironmentSetting.DeserializeEnvironmentSetting(item));
                    }
                    environmentSettings = array;
                    continue;
                }
                if (property.NameEquals("constraints"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    constraints = TaskConstraints.DeserializeTaskConstraints(property.Value);
                    continue;
                }
                if (property.NameEquals("waitForSuccess"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    waitForSuccess = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("userIdentity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    userIdentity = UserIdentity.DeserializeUserIdentity(property.Value);
                    continue;
                }
                if (property.NameEquals("rerunOnNodeRebootAfterSuccess"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    rerunOnNodeRebootAfterSuccess = property.Value.GetBoolean();
                    continue;
                }
            }
            return(new JobPreparationTask(id, commandLine, containerSettings, resourceFiles, environmentSettings, constraints, waitForSuccess, userIdentity, rerunOnNodeRebootAfterSuccess));
        }
        internal static StartTask DeserializeStartTask(JsonElement element)
        {
            string commandLine = default;
            TaskContainerSettings      containerSettings   = default;
            IList <ResourceFile>       resourceFiles       = default;
            IList <EnvironmentSetting> environmentSettings = default;
            UserIdentity userIdentity      = default;
            int?         maxTaskRetryCount = default;
            bool?        waitForSuccess    = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("commandLine"))
                {
                    commandLine = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("containerSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    containerSettings = TaskContainerSettings.DeserializeTaskContainerSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("resourceFiles"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <ResourceFile> array = new List <ResourceFile>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ResourceFile.DeserializeResourceFile(item));
                    }
                    resourceFiles = array;
                    continue;
                }
                if (property.NameEquals("environmentSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <EnvironmentSetting> array = new List <EnvironmentSetting>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(EnvironmentSetting.DeserializeEnvironmentSetting(item));
                    }
                    environmentSettings = array;
                    continue;
                }
                if (property.NameEquals("userIdentity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    userIdentity = UserIdentity.DeserializeUserIdentity(property.Value);
                    continue;
                }
                if (property.NameEquals("maxTaskRetryCount"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    maxTaskRetryCount = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("waitForSuccess"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    waitForSuccess = property.Value.GetBoolean();
                    continue;
                }
            }
            return(new StartTask(commandLine, containerSettings, resourceFiles, environmentSettings, userIdentity, maxTaskRetryCount, waitForSuccess));
        }
Пример #6
0
        internal static CloudJob DeserializeCloudJob(JsonElement element)
        {
            string             id                          = default;
            string             displayName                 = default;
            bool?              usesTaskDependencies        = default;
            string             url                         = default;
            string             eTag                        = default;
            DateTimeOffset?    lastModified                = default;
            DateTimeOffset?    creationTime                = default;
            JobState?          state                       = default;
            DateTimeOffset?    stateTransitionTime         = default;
            JobState?          previousState               = default;
            DateTimeOffset?    previousStateTransitionTime = default;
            int?               priority                    = default;
            JobConstraints     constraints                 = default;
            JobManagerTask     jobManagerTask              = default;
            JobPreparationTask jobPreparationTask          = default;
            JobReleaseTask     jobReleaseTask              = default;
            IReadOnlyList <EnvironmentSetting> commonEnvironmentSettings = default;
            PoolInformation              poolInfo             = default;
            OnAllTasksComplete?          onAllTasksComplete   = default;
            OnTaskFailure?               onTaskFailure        = default;
            JobNetworkConfiguration      networkConfiguration = default;
            IReadOnlyList <MetadataItem> metadata             = default;
            JobExecutionInformation      executionInfo        = default;
            JobStatistics                stats = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("displayName"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    displayName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("usesTaskDependencies"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    usesTaskDependencies = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("url"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    url = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("eTag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    eTag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("lastModified"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    lastModified = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("creationTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    creationTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("state"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    state = property.Value.GetString().ToJobState();
                    continue;
                }
                if (property.NameEquals("stateTransitionTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    stateTransitionTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("previousState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    previousState = property.Value.GetString().ToJobState();
                    continue;
                }
                if (property.NameEquals("previousStateTransitionTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    previousStateTransitionTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("priority"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    priority = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("constraints"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    constraints = JobConstraints.DeserializeJobConstraints(property.Value);
                    continue;
                }
                if (property.NameEquals("jobManagerTask"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    jobManagerTask = JobManagerTask.DeserializeJobManagerTask(property.Value);
                    continue;
                }
                if (property.NameEquals("jobPreparationTask"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    jobPreparationTask = JobPreparationTask.DeserializeJobPreparationTask(property.Value);
                    continue;
                }
                if (property.NameEquals("jobReleaseTask"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    jobReleaseTask = JobReleaseTask.DeserializeJobReleaseTask(property.Value);
                    continue;
                }
                if (property.NameEquals("commonEnvironmentSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <EnvironmentSetting> array = new List <EnvironmentSetting>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(EnvironmentSetting.DeserializeEnvironmentSetting(item));
                    }
                    commonEnvironmentSettings = array;
                    continue;
                }
                if (property.NameEquals("poolInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    poolInfo = PoolInformation.DeserializePoolInformation(property.Value);
                    continue;
                }
                if (property.NameEquals("onAllTasksComplete"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    onAllTasksComplete = property.Value.GetString().ToOnAllTasksComplete();
                    continue;
                }
                if (property.NameEquals("onTaskFailure"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    onTaskFailure = property.Value.GetString().ToOnTaskFailure();
                    continue;
                }
                if (property.NameEquals("networkConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    networkConfiguration = JobNetworkConfiguration.DeserializeJobNetworkConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("metadata"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <MetadataItem> array = new List <MetadataItem>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(MetadataItem.DeserializeMetadataItem(item));
                    }
                    metadata = array;
                    continue;
                }
                if (property.NameEquals("executionInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    executionInfo = JobExecutionInformation.DeserializeJobExecutionInformation(property.Value);
                    continue;
                }
                if (property.NameEquals("stats"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    stats = JobStatistics.DeserializeJobStatistics(property.Value);
                    continue;
                }
            }
            return(new CloudJob(id, displayName, usesTaskDependencies, url, eTag, lastModified, creationTime, state, stateTransitionTime, previousState, previousStateTransitionTime, priority, constraints, jobManagerTask, jobPreparationTask, jobReleaseTask, commonEnvironmentSettings, poolInfo, onAllTasksComplete, onTaskFailure, networkConfiguration, metadata, executionInfo, stats));
        }
        internal static CloudTask DeserializeCloudTask(JsonElement element)
        {
            string                                      id                           = default;
            string                                      displayName                  = default;
            string                                      url                          = default;
            string                                      eTag                         = default;
            DateTimeOffset?                             lastModified                 = default;
            DateTimeOffset?                             creationTime                 = default;
            ExitConditions                              exitConditions               = default;
            TaskState?                                  state                        = default;
            DateTimeOffset?                             stateTransitionTime          = default;
            TaskState?                                  previousState                = default;
            DateTimeOffset?                             previousStateTransitionTime  = default;
            string                                      commandLine                  = default;
            TaskContainerSettings                       containerSettings            = default;
            IReadOnlyList <ResourceFile>                resourceFiles                = default;
            IReadOnlyList <OutputFile>                  outputFiles                  = default;
            IReadOnlyList <EnvironmentSetting>          environmentSettings          = default;
            AffinityInformation                         affinityInfo                 = default;
            TaskConstraints                             constraints                  = default;
            UserIdentity                                userIdentity                 = default;
            TaskExecutionInformation                    executionInfo                = default;
            ComputeNodeInformation                      nodeInfo                     = default;
            MultiInstanceSettings                       multiInstanceSettings        = default;
            TaskStatistics                              stats                        = default;
            TaskDependencies                            dependsOn                    = default;
            IReadOnlyList <ApplicationPackageReference> applicationPackageReferences = default;
            AuthenticationTokenSettings                 authenticationTokenSettings  = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("id"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    id = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("displayName"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    displayName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("url"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    url = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("eTag"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    eTag = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("lastModified"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    lastModified = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("creationTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    creationTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("exitConditions"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    exitConditions = ExitConditions.DeserializeExitConditions(property.Value);
                    continue;
                }
                if (property.NameEquals("state"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    state = property.Value.GetString().ToTaskState();
                    continue;
                }
                if (property.NameEquals("stateTransitionTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    stateTransitionTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("previousState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    previousState = property.Value.GetString().ToTaskState();
                    continue;
                }
                if (property.NameEquals("previousStateTransitionTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    previousStateTransitionTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("commandLine"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    commandLine = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("containerSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    containerSettings = TaskContainerSettings.DeserializeTaskContainerSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("resourceFiles"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <ResourceFile> array = new List <ResourceFile>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ResourceFile.DeserializeResourceFile(item));
                    }
                    resourceFiles = array;
                    continue;
                }
                if (property.NameEquals("outputFiles"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <OutputFile> array = new List <OutputFile>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(OutputFile.DeserializeOutputFile(item));
                    }
                    outputFiles = array;
                    continue;
                }
                if (property.NameEquals("environmentSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <EnvironmentSetting> array = new List <EnvironmentSetting>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(EnvironmentSetting.DeserializeEnvironmentSetting(item));
                    }
                    environmentSettings = array;
                    continue;
                }
                if (property.NameEquals("affinityInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    affinityInfo = AffinityInformation.DeserializeAffinityInformation(property.Value);
                    continue;
                }
                if (property.NameEquals("constraints"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    constraints = TaskConstraints.DeserializeTaskConstraints(property.Value);
                    continue;
                }
                if (property.NameEquals("userIdentity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    userIdentity = UserIdentity.DeserializeUserIdentity(property.Value);
                    continue;
                }
                if (property.NameEquals("executionInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    executionInfo = TaskExecutionInformation.DeserializeTaskExecutionInformation(property.Value);
                    continue;
                }
                if (property.NameEquals("nodeInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    nodeInfo = ComputeNodeInformation.DeserializeComputeNodeInformation(property.Value);
                    continue;
                }
                if (property.NameEquals("multiInstanceSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    multiInstanceSettings = MultiInstanceSettings.DeserializeMultiInstanceSettings(property.Value);
                    continue;
                }
                if (property.NameEquals("stats"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    stats = TaskStatistics.DeserializeTaskStatistics(property.Value);
                    continue;
                }
                if (property.NameEquals("dependsOn"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    dependsOn = TaskDependencies.DeserializeTaskDependencies(property.Value);
                    continue;
                }
                if (property.NameEquals("applicationPackageReferences"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <ApplicationPackageReference> array = new List <ApplicationPackageReference>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ApplicationPackageReference.DeserializeApplicationPackageReference(item));
                    }
                    applicationPackageReferences = array;
                    continue;
                }
                if (property.NameEquals("authenticationTokenSettings"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    authenticationTokenSettings = AuthenticationTokenSettings.DeserializeAuthenticationTokenSettings(property.Value);
                    continue;
                }
            }
            return(new CloudTask(id, displayName, url, eTag, lastModified, creationTime, exitConditions, state, stateTransitionTime, previousState, previousStateTransitionTime, commandLine, containerSettings, resourceFiles, outputFiles, environmentSettings, affinityInfo, constraints, userIdentity, executionInfo, nodeInfo, multiInstanceSettings, stats, dependsOn, applicationPackageReferences, authenticationTokenSettings));
        }