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

com.azure.resourcemanager.devcenter.fluent.models.SyncErrorDetailsInner 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.fluent.models;

import com.azure.core.annotation.Immutable;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.devcenter.models.CatalogConflictError;
import com.azure.resourcemanager.devcenter.models.CatalogErrorDetails;
import com.azure.resourcemanager.devcenter.models.CatalogSyncError;
import java.io.IOException;
import java.util.List;

/**
 * Synchronization error details.
 */
@Immutable
public final class SyncErrorDetailsInner implements JsonSerializable {
    /*
     * Error information for the overall synchronization operation.
     */
    private CatalogErrorDetails operationError;

    /*
     * Catalog items that have conflicting names.
     */
    private List conflicts;

    /*
     * Errors that occured during synchronization.
     */
    private List errors;

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

    /**
     * Get the operationError property: Error information for the overall synchronization operation.
     * 
     * @return the operationError value.
     */
    public CatalogErrorDetails operationError() {
        return this.operationError;
    }

    /**
     * Get the conflicts property: Catalog items that have conflicting names.
     * 
     * @return the conflicts value.
     */
    public List conflicts() {
        return this.conflicts;
    }

    /**
     * Get the errors property: Errors that occured during synchronization.
     * 
     * @return the errors value.
     */
    public List errors() {
        return this.errors;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (operationError() != null) {
            operationError().validate();
        }
        if (conflicts() != null) {
            conflicts().forEach(e -> e.validate());
        }
        if (errors() != null) {
            errors().forEach(e -> e.validate());
        }
    }

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

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

                if ("operationError".equals(fieldName)) {
                    deserializedSyncErrorDetailsInner.operationError = CatalogErrorDetails.fromJson(reader);
                } else if ("conflicts".equals(fieldName)) {
                    List conflicts
                        = reader.readArray(reader1 -> CatalogConflictError.fromJson(reader1));
                    deserializedSyncErrorDetailsInner.conflicts = conflicts;
                } else if ("errors".equals(fieldName)) {
                    List errors = reader.readArray(reader1 -> CatalogSyncError.fromJson(reader1));
                    deserializedSyncErrorDetailsInner.errors = errors;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedSyncErrorDetailsInner;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy