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

com.azure.resourcemanager.recoveryservices.models.JobsSummary 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.recoveryservices.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 java.io.IOException;

/**
 * Summary of the replication job data for this vault.
 */
@Fluent
public final class JobsSummary implements JsonSerializable {
    /*
     * Count of failed jobs.
     */
    private Integer failedJobs;

    /*
     * Count of suspended jobs.
     */
    private Integer suspendedJobs;

    /*
     * Count of in-progress jobs.
     */
    private Integer inProgressJobs;

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

    /**
     * Get the failedJobs property: Count of failed jobs.
     * 
     * @return the failedJobs value.
     */
    public Integer failedJobs() {
        return this.failedJobs;
    }

    /**
     * Set the failedJobs property: Count of failed jobs.
     * 
     * @param failedJobs the failedJobs value to set.
     * @return the JobsSummary object itself.
     */
    public JobsSummary withFailedJobs(Integer failedJobs) {
        this.failedJobs = failedJobs;
        return this;
    }

    /**
     * Get the suspendedJobs property: Count of suspended jobs.
     * 
     * @return the suspendedJobs value.
     */
    public Integer suspendedJobs() {
        return this.suspendedJobs;
    }

    /**
     * Set the suspendedJobs property: Count of suspended jobs.
     * 
     * @param suspendedJobs the suspendedJobs value to set.
     * @return the JobsSummary object itself.
     */
    public JobsSummary withSuspendedJobs(Integer suspendedJobs) {
        this.suspendedJobs = suspendedJobs;
        return this;
    }

    /**
     * Get the inProgressJobs property: Count of in-progress jobs.
     * 
     * @return the inProgressJobs value.
     */
    public Integer inProgressJobs() {
        return this.inProgressJobs;
    }

    /**
     * Set the inProgressJobs property: Count of in-progress jobs.
     * 
     * @param inProgressJobs the inProgressJobs value to set.
     * @return the JobsSummary object itself.
     */
    public JobsSummary withInProgressJobs(Integer inProgressJobs) {
        this.inProgressJobs = inProgressJobs;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeNumberField("failedJobs", this.failedJobs);
        jsonWriter.writeNumberField("suspendedJobs", this.suspendedJobs);
        jsonWriter.writeNumberField("inProgressJobs", this.inProgressJobs);
        return jsonWriter.writeEndObject();
    }

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

                if ("failedJobs".equals(fieldName)) {
                    deserializedJobsSummary.failedJobs = reader.getNullable(JsonReader::getInt);
                } else if ("suspendedJobs".equals(fieldName)) {
                    deserializedJobsSummary.suspendedJobs = reader.getNullable(JsonReader::getInt);
                } else if ("inProgressJobs".equals(fieldName)) {
                    deserializedJobsSummary.inProgressJobs = reader.getNullable(JsonReader::getInt);
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedJobsSummary;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy