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

com.azure.resourcemanager.automation.models.DscReportError 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.automation.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;

/**
 * Definition of the dsc node report error type.
 */
@Fluent
public final class DscReportError implements JsonSerializable {
    /*
     * Gets or sets the source of the error.
     */
    private String errorSource;

    /*
     * Gets or sets the resource ID which generated the error.
     */
    private String resourceId;

    /*
     * Gets or sets the error code.
     */
    private String errorCode;

    /*
     * Gets or sets the error message.
     */
    private String errorMessage;

    /*
     * Gets or sets the locale of the error.
     */
    private String locale;

    /*
     * Gets or sets the error details.
     */
    private String errorDetails;

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

    /**
     * Get the errorSource property: Gets or sets the source of the error.
     * 
     * @return the errorSource value.
     */
    public String errorSource() {
        return this.errorSource;
    }

    /**
     * Set the errorSource property: Gets or sets the source of the error.
     * 
     * @param errorSource the errorSource value to set.
     * @return the DscReportError object itself.
     */
    public DscReportError withErrorSource(String errorSource) {
        this.errorSource = errorSource;
        return this;
    }

    /**
     * Get the resourceId property: Gets or sets the resource ID which generated the error.
     * 
     * @return the resourceId value.
     */
    public String resourceId() {
        return this.resourceId;
    }

    /**
     * Set the resourceId property: Gets or sets the resource ID which generated the error.
     * 
     * @param resourceId the resourceId value to set.
     * @return the DscReportError object itself.
     */
    public DscReportError withResourceId(String resourceId) {
        this.resourceId = resourceId;
        return this;
    }

    /**
     * Get the errorCode property: Gets or sets the error code.
     * 
     * @return the errorCode value.
     */
    public String errorCode() {
        return this.errorCode;
    }

    /**
     * Set the errorCode property: Gets or sets the error code.
     * 
     * @param errorCode the errorCode value to set.
     * @return the DscReportError object itself.
     */
    public DscReportError withErrorCode(String errorCode) {
        this.errorCode = errorCode;
        return this;
    }

    /**
     * Get the errorMessage property: Gets or sets the error message.
     * 
     * @return the errorMessage value.
     */
    public String errorMessage() {
        return this.errorMessage;
    }

    /**
     * Set the errorMessage property: Gets or sets the error message.
     * 
     * @param errorMessage the errorMessage value to set.
     * @return the DscReportError object itself.
     */
    public DscReportError withErrorMessage(String errorMessage) {
        this.errorMessage = errorMessage;
        return this;
    }

    /**
     * Get the locale property: Gets or sets the locale of the error.
     * 
     * @return the locale value.
     */
    public String locale() {
        return this.locale;
    }

    /**
     * Set the locale property: Gets or sets the locale of the error.
     * 
     * @param locale the locale value to set.
     * @return the DscReportError object itself.
     */
    public DscReportError withLocale(String locale) {
        this.locale = locale;
        return this;
    }

    /**
     * Get the errorDetails property: Gets or sets the error details.
     * 
     * @return the errorDetails value.
     */
    public String errorDetails() {
        return this.errorDetails;
    }

    /**
     * Set the errorDetails property: Gets or sets the error details.
     * 
     * @param errorDetails the errorDetails value to set.
     * @return the DscReportError object itself.
     */
    public DscReportError withErrorDetails(String errorDetails) {
        this.errorDetails = errorDetails;
        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.writeStringField("errorSource", this.errorSource);
        jsonWriter.writeStringField("resourceId", this.resourceId);
        jsonWriter.writeStringField("errorCode", this.errorCode);
        jsonWriter.writeStringField("errorMessage", this.errorMessage);
        jsonWriter.writeStringField("locale", this.locale);
        jsonWriter.writeStringField("errorDetails", this.errorDetails);
        return jsonWriter.writeEndObject();
    }

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

                if ("errorSource".equals(fieldName)) {
                    deserializedDscReportError.errorSource = reader.getString();
                } else if ("resourceId".equals(fieldName)) {
                    deserializedDscReportError.resourceId = reader.getString();
                } else if ("errorCode".equals(fieldName)) {
                    deserializedDscReportError.errorCode = reader.getString();
                } else if ("errorMessage".equals(fieldName)) {
                    deserializedDscReportError.errorMessage = reader.getString();
                } else if ("locale".equals(fieldName)) {
                    deserializedDscReportError.locale = reader.getString();
                } else if ("errorDetails".equals(fieldName)) {
                    deserializedDscReportError.errorDetails = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedDscReportError;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy