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

com.azure.resourcemanager.mediaservices.models.JobError Maven / Gradle / Ivy

Go to download

This package contains Microsoft Azure SDK for MediaServices Management SDK. For documentation on how to use this package, please see https://aka.ms/azsdk/java/mgmt. This Swagger was generated by the API Framework. Package tag package-account-2023-01.

The newest version!
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.mediaservices.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 java.io.IOException;
import java.util.List;

/**
 * Details of JobOutput errors.
 */
@Immutable
public final class JobError implements JsonSerializable {
    /*
     * Error code describing the error.
     */
    private JobErrorCode code;

    /*
     * A human-readable language-dependent representation of the error.
     */
    private String message;

    /*
     * Helps with categorization of errors.
     */
    private JobErrorCategory category;

    /*
     * Indicates that it may be possible to retry the Job. If retry is unsuccessful, please contact Azure support via
     * Azure Portal.
     */
    private JobRetry retry;

    /*
     * An array of details about specific errors that led to this reported error.
     */
    private List details;

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

    /**
     * Get the code property: Error code describing the error.
     * 
     * @return the code value.
     */
    public JobErrorCode code() {
        return this.code;
    }

    /**
     * Get the message property: A human-readable language-dependent representation of the error.
     * 
     * @return the message value.
     */
    public String message() {
        return this.message;
    }

    /**
     * Get the category property: Helps with categorization of errors.
     * 
     * @return the category value.
     */
    public JobErrorCategory category() {
        return this.category;
    }

    /**
     * Get the retry property: Indicates that it may be possible to retry the Job. If retry is unsuccessful, please
     * contact Azure support via Azure Portal.
     * 
     * @return the retry value.
     */
    public JobRetry retry() {
        return this.retry;
    }

    /**
     * Get the details property: An array of details about specific errors that led to this reported error.
     * 
     * @return the details value.
     */
    public List details() {
        return this.details;
    }

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

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

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

                if ("code".equals(fieldName)) {
                    deserializedJobError.code = JobErrorCode.fromString(reader.getString());
                } else if ("message".equals(fieldName)) {
                    deserializedJobError.message = reader.getString();
                } else if ("category".equals(fieldName)) {
                    deserializedJobError.category = JobErrorCategory.fromString(reader.getString());
                } else if ("retry".equals(fieldName)) {
                    deserializedJobError.retry = JobRetry.fromString(reader.getString());
                } else if ("details".equals(fieldName)) {
                    List details = reader.readArray(reader1 -> JobErrorDetail.fromJson(reader1));
                    deserializedJobError.details = details;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedJobError;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy