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

com.azure.resourcemanager.devcenter.models.SyncStats 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.devcenter.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;
import java.util.List;

/**
 * Stats of the synchronization.
 */
@Fluent
public final class SyncStats implements JsonSerializable {
    /*
     * Count of catalog items added during synchronization.
     */
    private Integer added;

    /*
     * Count of catalog items updated during synchronization.
     */
    private Integer updated;

    /*
     * Count of catalog items that were unchanged during synchronization.
     */
    private Integer unchanged;

    /*
     * Count of catalog items removed during synchronization.
     */
    private Integer removed;

    /*
     * Count of catalog items that had validation errors during synchronization.
     */
    private Integer validationErrors;

    /*
     * Count of synchronization errors that occured during synchronization.
     */
    private Integer synchronizationErrors;

    /*
     * Indicates catalog item types that were synced.
     */
    private List syncedCatalogItemTypes;

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

    /**
     * Get the added property: Count of catalog items added during synchronization.
     * 
     * @return the added value.
     */
    public Integer added() {
        return this.added;
    }

    /**
     * Get the updated property: Count of catalog items updated during synchronization.
     * 
     * @return the updated value.
     */
    public Integer updated() {
        return this.updated;
    }

    /**
     * Get the unchanged property: Count of catalog items that were unchanged during synchronization.
     * 
     * @return the unchanged value.
     */
    public Integer unchanged() {
        return this.unchanged;
    }

    /**
     * Get the removed property: Count of catalog items removed during synchronization.
     * 
     * @return the removed value.
     */
    public Integer removed() {
        return this.removed;
    }

    /**
     * Get the validationErrors property: Count of catalog items that had validation errors during synchronization.
     * 
     * @return the validationErrors value.
     */
    public Integer validationErrors() {
        return this.validationErrors;
    }

    /**
     * Get the synchronizationErrors property: Count of synchronization errors that occured during synchronization.
     * 
     * @return the synchronizationErrors value.
     */
    public Integer synchronizationErrors() {
        return this.synchronizationErrors;
    }

    /**
     * Get the syncedCatalogItemTypes property: Indicates catalog item types that were synced.
     * 
     * @return the syncedCatalogItemTypes value.
     */
    public List syncedCatalogItemTypes() {
        return this.syncedCatalogItemTypes;
    }

    /**
     * Set the syncedCatalogItemTypes property: Indicates catalog item types that were synced.
     * 
     * @param syncedCatalogItemTypes the syncedCatalogItemTypes value to set.
     * @return the SyncStats object itself.
     */
    public SyncStats withSyncedCatalogItemTypes(List syncedCatalogItemTypes) {
        this.syncedCatalogItemTypes = syncedCatalogItemTypes;
        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.writeArrayField("syncedCatalogItemTypes", this.syncedCatalogItemTypes,
            (writer, element) -> writer.writeString(element == null ? null : element.toString()));
        return jsonWriter.writeEndObject();
    }

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

                if ("added".equals(fieldName)) {
                    deserializedSyncStats.added = reader.getNullable(JsonReader::getInt);
                } else if ("updated".equals(fieldName)) {
                    deserializedSyncStats.updated = reader.getNullable(JsonReader::getInt);
                } else if ("unchanged".equals(fieldName)) {
                    deserializedSyncStats.unchanged = reader.getNullable(JsonReader::getInt);
                } else if ("removed".equals(fieldName)) {
                    deserializedSyncStats.removed = reader.getNullable(JsonReader::getInt);
                } else if ("validationErrors".equals(fieldName)) {
                    deserializedSyncStats.validationErrors = reader.getNullable(JsonReader::getInt);
                } else if ("synchronizationErrors".equals(fieldName)) {
                    deserializedSyncStats.synchronizationErrors = reader.getNullable(JsonReader::getInt);
                } else if ("syncedCatalogItemTypes".equals(fieldName)) {
                    List syncedCatalogItemTypes
                        = reader.readArray(reader1 -> CatalogItemType.fromString(reader1.getString()));
                    deserializedSyncStats.syncedCatalogItemTypes = syncedCatalogItemTypes;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSyncStats;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy