Пример #1
0
        internal static CloudPool DeserializeCloudPool(JsonElement element)
        {
            string                      id                                           = default;
            string                      displayName                                  = default;
            string                      url                                          = default;
            string                      eTag                                         = default;
            DateTimeOffset?             lastModified                                 = default;
            DateTimeOffset?             creationTime                                 = default;
            PoolState?                  state                                        = default;
            DateTimeOffset?             stateTransitionTime                          = default;
            AllocationState?            allocationState                              = default;
            DateTimeOffset?             allocationStateTransitionTime                = default;
            string                      vmSize                                       = default;
            CloudServiceConfiguration   cloudServiceConfiguration                    = default;
            VirtualMachineConfiguration virtualMachineConfiguration                  = default;
            TimeSpan?                   resizeTimeout                                = default;
            IReadOnlyList <ResizeError> resizeErrors                                 = default;
            int?                 currentDedicatedNodes                               = default;
            int?                 currentLowPriorityNodes                             = default;
            int?                 targetDedicatedNodes                                = default;
            int?                 targetLowPriorityNodes                              = default;
            bool?                enableAutoScale                                     = default;
            string               autoScaleFormula                                    = default;
            TimeSpan?            autoScaleEvaluationInterval                         = default;
            AutoScaleRun         autoScaleRun                                        = default;
            bool?                enableInterNodeCommunication                        = default;
            NetworkConfiguration networkConfiguration                                = default;
            StartTask            startTask                                           = default;
            IReadOnlyList <CertificateReference>        certificateReferences        = default;
            IReadOnlyList <ApplicationPackageReference> applicationPackageReferences = default;
            IReadOnlyList <string> applicationLicenses                               = default;
            int?maxTasksPerNode = default;
            TaskSchedulingPolicy         taskSchedulingPolicy = default;
            IReadOnlyList <UserAccount>  userAccounts         = default;
            IReadOnlyList <MetadataItem> metadata             = default;
            PoolStatistics stats = default;
            IReadOnlyList <MountConfiguration> mountConfiguration = 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("state"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    state = property.Value.GetString().ToPoolState();
                    continue;
                }
                if (property.NameEquals("stateTransitionTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    stateTransitionTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("allocationState"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    allocationState = property.Value.GetString().ToAllocationState();
                    continue;
                }
                if (property.NameEquals("allocationStateTransitionTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    allocationStateTransitionTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("vmSize"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    vmSize = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("cloudServiceConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    cloudServiceConfiguration = CloudServiceConfiguration.DeserializeCloudServiceConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("virtualMachineConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    virtualMachineConfiguration = VirtualMachineConfiguration.DeserializeVirtualMachineConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("resizeTimeout"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    resizeTimeout = property.Value.GetTimeSpan("P");
                    continue;
                }
                if (property.NameEquals("resizeErrors"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <ResizeError> array = new List <ResizeError>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(ResizeError.DeserializeResizeError(item));
                    }
                    resizeErrors = array;
                    continue;
                }
                if (property.NameEquals("currentDedicatedNodes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    currentDedicatedNodes = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("currentLowPriorityNodes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    currentLowPriorityNodes = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("targetDedicatedNodes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    targetDedicatedNodes = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("targetLowPriorityNodes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    targetLowPriorityNodes = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("enableAutoScale"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    enableAutoScale = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("autoScaleFormula"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    autoScaleFormula = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("autoScaleEvaluationInterval"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    autoScaleEvaluationInterval = property.Value.GetTimeSpan("P");
                    continue;
                }
                if (property.NameEquals("autoScaleRun"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    autoScaleRun = AutoScaleRun.DeserializeAutoScaleRun(property.Value);
                    continue;
                }
                if (property.NameEquals("enableInterNodeCommunication"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    enableInterNodeCommunication = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("networkConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    networkConfiguration = NetworkConfiguration.DeserializeNetworkConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("startTask"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    startTask = StartTask.DeserializeStartTask(property.Value);
                    continue;
                }
                if (property.NameEquals("certificateReferences"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <CertificateReference> array = new List <CertificateReference>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(CertificateReference.DeserializeCertificateReference(item));
                    }
                    certificateReferences = array;
                    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("applicationLicenses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    applicationLicenses = array;
                    continue;
                }
                if (property.NameEquals("maxTasksPerNode"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    maxTasksPerNode = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("taskSchedulingPolicy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    taskSchedulingPolicy = TaskSchedulingPolicy.DeserializeTaskSchedulingPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("userAccounts"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <UserAccount> array = new List <UserAccount>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(UserAccount.DeserializeUserAccount(item));
                    }
                    userAccounts = array;
                    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("stats"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    stats = PoolStatistics.DeserializePoolStatistics(property.Value);
                    continue;
                }
                if (property.NameEquals("mountConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <MountConfiguration> array = new List <MountConfiguration>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(Models.MountConfiguration.DeserializeMountConfiguration(item));
                    }
                    mountConfiguration = array;
                    continue;
                }
            }
            return(new CloudPool(id, displayName, url, eTag, lastModified, creationTime, state, stateTransitionTime, allocationState, allocationStateTransitionTime, vmSize, cloudServiceConfiguration, virtualMachineConfiguration, resizeTimeout, resizeErrors, currentDedicatedNodes, currentLowPriorityNodes, targetDedicatedNodes, targetLowPriorityNodes, enableAutoScale, autoScaleFormula, autoScaleEvaluationInterval, autoScaleRun, enableInterNodeCommunication, networkConfiguration, startTask, certificateReferences, applicationPackageReferences, applicationLicenses, maxTasksPerNode, taskSchedulingPolicy, userAccounts, metadata, stats, mountConfiguration));
        }
        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));
        }
Пример #3
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 CloudJobSchedule DeserializeCloudJobSchedule(JsonElement element)
        {
            string           id                           = default;
            string           displayName                  = default;
            string           url                          = default;
            string           eTag                         = default;
            DateTimeOffset?  lastModified                 = default;
            DateTimeOffset?  creationTime                 = default;
            JobScheduleState?state                        = default;
            DateTimeOffset?  stateTransitionTime          = default;
            JobScheduleState?previousState                = default;
            DateTimeOffset?  previousStateTransitionTime  = default;
            Schedule         schedule                     = default;
            JobSpecification jobSpecification             = default;
            JobScheduleExecutionInformation executionInfo = default;
            IReadOnlyList <MetadataItem>    metadata      = default;
            JobScheduleStatistics           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("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().ToJobScheduleState();
                    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().ToJobScheduleState();
                    continue;
                }
                if (property.NameEquals("previousStateTransitionTime"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    previousStateTransitionTime = property.Value.GetDateTimeOffset("S");
                    continue;
                }
                if (property.NameEquals("schedule"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    schedule = Schedule.DeserializeSchedule(property.Value);
                    continue;
                }
                if (property.NameEquals("jobSpecification"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    jobSpecification = JobSpecification.DeserializeJobSpecification(property.Value);
                    continue;
                }
                if (property.NameEquals("executionInfo"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    executionInfo = JobScheduleExecutionInformation.DeserializeJobScheduleExecutionInformation(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("stats"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    stats = JobScheduleStatistics.DeserializeJobScheduleStatistics(property.Value);
                    continue;
                }
            }
            return(new CloudJobSchedule(id, displayName, url, eTag, lastModified, creationTime, state, stateTransitionTime, previousState, previousStateTransitionTime, schedule, jobSpecification, executionInfo, metadata, stats));
        }
        internal static PoolSpecification DeserializePoolSpecification(JsonElement element)
        {
            string displayName = default;
            string vmSize      = default;
            CloudServiceConfiguration   cloudServiceConfiguration   = default;
            VirtualMachineConfiguration virtualMachineConfiguration = default;
            int?maxTasksPerNode = default;
            TaskSchedulingPolicy taskSchedulingPolicy = default;
            TimeSpan?            resizeTimeout        = default;
            int?                                targetDedicatedNodes         = default;
            int?                                targetLowPriorityNodes       = default;
            bool?                               enableAutoScale              = default;
            string                              autoScaleFormula             = default;
            TimeSpan?                           autoScaleEvaluationInterval  = default;
            bool?                               enableInterNodeCommunication = default;
            NetworkConfiguration                networkConfiguration         = default;
            StartTask                           startTask                    = default;
            IList <CertificateReference>        certificateReferences        = default;
            IList <ApplicationPackageReference> applicationPackageReferences = default;
            IList <string>                      applicationLicenses          = default;
            IList <UserAccount>                 userAccounts                 = default;
            IList <MetadataItem>                metadata           = default;
            IList <MountConfiguration>          mountConfiguration = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("displayName"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    displayName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("vmSize"))
                {
                    vmSize = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("cloudServiceConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    cloudServiceConfiguration = CloudServiceConfiguration.DeserializeCloudServiceConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("virtualMachineConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    virtualMachineConfiguration = VirtualMachineConfiguration.DeserializeVirtualMachineConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("maxTasksPerNode"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    maxTasksPerNode = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("taskSchedulingPolicy"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    taskSchedulingPolicy = TaskSchedulingPolicy.DeserializeTaskSchedulingPolicy(property.Value);
                    continue;
                }
                if (property.NameEquals("resizeTimeout"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    resizeTimeout = property.Value.GetTimeSpan("P");
                    continue;
                }
                if (property.NameEquals("targetDedicatedNodes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    targetDedicatedNodes = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("targetLowPriorityNodes"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    targetLowPriorityNodes = property.Value.GetInt32();
                    continue;
                }
                if (property.NameEquals("enableAutoScale"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    enableAutoScale = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("autoScaleFormula"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    autoScaleFormula = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("autoScaleEvaluationInterval"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    autoScaleEvaluationInterval = property.Value.GetTimeSpan("P");
                    continue;
                }
                if (property.NameEquals("enableInterNodeCommunication"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    enableInterNodeCommunication = property.Value.GetBoolean();
                    continue;
                }
                if (property.NameEquals("networkConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    networkConfiguration = NetworkConfiguration.DeserializeNetworkConfiguration(property.Value);
                    continue;
                }
                if (property.NameEquals("startTask"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    startTask = StartTask.DeserializeStartTask(property.Value);
                    continue;
                }
                if (property.NameEquals("certificateReferences"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <CertificateReference> array = new List <CertificateReference>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(CertificateReference.DeserializeCertificateReference(item));
                    }
                    certificateReferences = array;
                    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("applicationLicenses"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <string> array = new List <string>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(item.GetString());
                    }
                    applicationLicenses = array;
                    continue;
                }
                if (property.NameEquals("userAccounts"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <UserAccount> array = new List <UserAccount>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(UserAccount.DeserializeUserAccount(item));
                    }
                    userAccounts = array;
                    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("mountConfiguration"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        continue;
                    }
                    List <MountConfiguration> array = new List <MountConfiguration>();
                    foreach (var item in property.Value.EnumerateArray())
                    {
                        array.Add(Models.MountConfiguration.DeserializeMountConfiguration(item));
                    }
                    mountConfiguration = array;
                    continue;
                }
            }
            return(new PoolSpecification(displayName, vmSize, cloudServiceConfiguration, virtualMachineConfiguration, maxTasksPerNode, taskSchedulingPolicy, resizeTimeout, targetDedicatedNodes, targetLowPriorityNodes, enableAutoScale, autoScaleFormula, autoScaleEvaluationInterval, enableInterNodeCommunication, networkConfiguration, startTask, certificateReferences, applicationPackageReferences, applicationLicenses, userAccounts, metadata, mountConfiguration));
        }