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

com.azure.resourcemanager.databoxedge.fluent.models.JobProperties 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.Fluent;
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.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;

/**
 * The properties for the job.
 */
@Fluent
public final class JobProperties implements JsonSerializable {
    /*
     * The type of the job.
     */
    private JobType jobType;

    /*
     * Current stage of the update operation.
     */
    private UpdateOperationStage currentStage;

    /*
     * The download progress.
     */
    private UpdateDownloadProgress downloadProgress;

    /*
     * The install progress.
     */
    private UpdateInstallProgress installProgress;

    /*
     * Total number of errors encountered during the refresh process.
     */
    private Integer totalRefreshErrors;

    /*
     * Local share/remote container relative path to the error manifest file of the refresh.
     */
    private String errorManifestFile;

    /*
     * ARM ID of the entity that was refreshed.
     */
    private String refreshedEntityId;

    /*
     * 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.)
     */
    private String folder;

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

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

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

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

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

    /**
     * Get the totalRefreshErrors property: Total number of errors encountered during the refresh process.
     * 
     * @return the totalRefreshErrors value.
     */
    public Integer totalRefreshErrors() {
        return this.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.errorManifestFile;
    }

    /**
     * Get the refreshedEntityId property: ARM ID of the entity that was refreshed.
     * 
     * @return the refreshedEntityId value.
     */
    public String refreshedEntityId() {
        return this.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.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 JobProperties object itself.
     */
    public JobProperties withFolder(String folder) {
        this.folder = folder;
        return this;
    }

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

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

    /**
     * Reads an instance of JobProperties from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of JobProperties 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 JobProperties.
     */
    public static JobProperties fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            JobProperties deserializedJobProperties = new JobProperties();
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("jobType".equals(fieldName)) {
                    deserializedJobProperties.jobType = JobType.fromString(reader.getString());
                } else if ("currentStage".equals(fieldName)) {
                    deserializedJobProperties.currentStage = UpdateOperationStage.fromString(reader.getString());
                } else if ("downloadProgress".equals(fieldName)) {
                    deserializedJobProperties.downloadProgress = UpdateDownloadProgress.fromJson(reader);
                } else if ("installProgress".equals(fieldName)) {
                    deserializedJobProperties.installProgress = UpdateInstallProgress.fromJson(reader);
                } else if ("totalRefreshErrors".equals(fieldName)) {
                    deserializedJobProperties.totalRefreshErrors = reader.getNullable(JsonReader::getInt);
                } else if ("errorManifestFile".equals(fieldName)) {
                    deserializedJobProperties.errorManifestFile = reader.getString();
                } else if ("refreshedEntityId".equals(fieldName)) {
                    deserializedJobProperties.refreshedEntityId = reader.getString();
                } else if ("folder".equals(fieldName)) {
                    deserializedJobProperties.folder = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedJobProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy