All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.resourcemanager.databoxedge.fluent.models.JobInner Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.databoxedge.fluent.models;

import com.azure.core.annotation.Immutable;
import com.azure.core.util.CoreUtils;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.databoxedge.models.JobErrorDetails;
import com.azure.resourcemanager.databoxedge.models.JobStatus;
import com.azure.resourcemanager.databoxedge.models.JobType;
import com.azure.resourcemanager.databoxedge.models.UpdateDownloadProgress;
import com.azure.resourcemanager.databoxedge.models.UpdateInstallProgress;
import com.azure.resourcemanager.databoxedge.models.UpdateOperationStage;
import java.io.IOException;
import java.time.OffsetDateTime;

/**
 * A device job.
 */
@Immutable
public final class JobInner implements JsonSerializable {
    /*
     * The path ID that uniquely identifies the object.
     */
    private String id;

    /*
     * The name of the object.
     */
    private String name;

    /*
     * The hierarchical type of the object.
     */
    private String type;

    /*
     * The current status of the job.
     */
    private JobStatus status;

    /*
     * The UTC date and time at which the job started.
     */
    private OffsetDateTime startTime;

    /*
     * The UTC date and time at which the job completed.
     */
    private OffsetDateTime endTime;

    /*
     * The percentage of the job that is complete.
     */
    private Integer percentComplete;

    /*
     * The error details.
     */
    private JobErrorDetails error;

    /*
     * The properties of the job.
     */
    private JobProperties innerProperties;

    /**
     * Creates an instance of JobInner class.
     */
    public JobInner() {
    }

    /**
     * Get the id property: The path ID that uniquely identifies the object.
     * 
     * @return the id value.
     */
    public String id() {
        return this.id;
    }

    /**
     * Get the name property: The name of the object.
     * 
     * @return the name value.
     */
    public String name() {
        return this.name;
    }

    /**
     * Get the type property: The hierarchical type of the object.
     * 
     * @return the type value.
     */
    public String type() {
        return this.type;
    }

    /**
     * Get the status property: The current status of the job.
     * 
     * @return the status value.
     */
    public JobStatus status() {
        return this.status;
    }

    /**
     * Get the startTime property: The UTC date and time at which the job started.
     * 
     * @return the startTime value.
     */
    public OffsetDateTime startTime() {
        return this.startTime;
    }

    /**
     * Get the endTime property: The UTC date and time at which the job completed.
     * 
     * @return the endTime value.
     */
    public OffsetDateTime endTime() {
        return this.endTime;
    }

    /**
     * Get the percentComplete property: The percentage of the job that is complete.
     * 
     * @return the percentComplete value.
     */
    public Integer percentComplete() {
        return this.percentComplete;
    }

    /**
     * Get the error property: The error details.
     * 
     * @return the error value.
     */
    public JobErrorDetails error() {
        return this.error;
    }

    /**
     * Get the innerProperties property: The properties of the job.
     * 
     * @return the innerProperties value.
     */
    private JobProperties innerProperties() {
        return this.innerProperties;
    }

    /**
     * Get the jobType property: The type of the job.
     * 
     * @return the jobType value.
     */
    public JobType jobType() {
        return this.innerProperties() == null ? null : this.innerProperties().jobType();
    }

    /**
     * Get the currentStage property: Current stage of the update operation.
     * 
     * @return the currentStage value.
     */
    public UpdateOperationStage currentStage() {
        return this.innerProperties() == null ? null : this.innerProperties().currentStage();
    }

    /**
     * Get the downloadProgress property: The download progress.
     * 
     * @return the downloadProgress value.
     */
    public UpdateDownloadProgress downloadProgress() {
        return this.innerProperties() == null ? null : this.innerProperties().downloadProgress();
    }

    /**
     * Get the installProgress property: The install progress.
     * 
     * @return the installProgress value.
     */
    public UpdateInstallProgress installProgress() {
        return this.innerProperties() == null ? null : this.innerProperties().installProgress();
    }

    /**
     * Get the totalRefreshErrors property: Total number of errors encountered during the refresh process.
     * 
     * @return the totalRefreshErrors value.
     */
    public Integer totalRefreshErrors() {
        return this.innerProperties() == null ? null : this.innerProperties().totalRefreshErrors();
    }

    /**
     * Get the errorManifestFile property: Local share/remote container relative path to the error manifest file of the
     * refresh.
     * 
     * @return the errorManifestFile value.
     */
    public String errorManifestFile() {
        return this.innerProperties() == null ? null : this.innerProperties().errorManifestFile();
    }

    /**
     * Get the refreshedEntityId property: ARM ID of the entity that was refreshed.
     * 
     * @return the refreshedEntityId value.
     */
    public String refreshedEntityId() {
        return this.innerProperties() == null ? null : this.innerProperties().refreshedEntityId();
    }

    /**
     * Get the folder property: If only subfolders need to be refreshed, then the subfolder path inside the share or
     * container. (The path is empty if there are no subfolders.).
     * 
     * @return the folder value.
     */
    public String folder() {
        return this.innerProperties() == null ? null : this.innerProperties().folder();
    }

    /**
     * Set the folder property: If only subfolders need to be refreshed, then the subfolder path inside the share or
     * container. (The path is empty if there are no subfolders.).
     * 
     * @param folder the folder value to set.
     * @return the JobInner object itself.
     */
    public JobInner withFolder(String folder) {
        if (this.innerProperties() == null) {
            this.innerProperties = new JobProperties();
        }
        this.innerProperties().withFolder(folder);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (error() != null) {
            error().validate();
        }
        if (innerProperties() != null) {
            innerProperties().validate();
        }
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of JobInner from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of JobInner if the JsonReader was pointing to an instance of it, or null if it was pointing
     * to JSON null.
     * @throws IOException If an error occurs while reading the JobInner.
     */
    public static JobInner fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            JobInner deserializedJobInner = new JobInner();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("id".equals(fieldName)) {
                    deserializedJobInner.id = reader.getString();
                } else if ("name".equals(fieldName)) {
                    deserializedJobInner.name = reader.getString();
                } else if ("type".equals(fieldName)) {
                    deserializedJobInner.type = reader.getString();
                } else if ("status".equals(fieldName)) {
                    deserializedJobInner.status = JobStatus.fromString(reader.getString());
                } else if ("startTime".equals(fieldName)) {
                    deserializedJobInner.startTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("endTime".equals(fieldName)) {
                    deserializedJobInner.endTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("percentComplete".equals(fieldName)) {
                    deserializedJobInner.percentComplete = reader.getNullable(JsonReader::getInt);
                } else if ("error".equals(fieldName)) {
                    deserializedJobInner.error = JobErrorDetails.fromJson(reader);
                } else if ("properties".equals(fieldName)) {
                    deserializedJobInner.innerProperties = JobProperties.fromJson(reader);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedJobInner;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy