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

com.azure.messaging.eventgrid.systemevents.MediaJobOutputProgressEventData Maven / Gradle / Ivy

There is a newer version: 4.27.0
Show 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.messaging.eventgrid.systemevents;

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.Map;

/**
 * Job Output Progress Event Data. Schema of the Data property of an EventGridEvent for a
 * Microsoft.Media.JobOutputProgress event.
 */
@Fluent
public final class MediaJobOutputProgressEventData implements JsonSerializable {
    /*
     * Gets the Job output label.
     */
    private String label;

    /*
     * Gets the Job output progress.
     */
    private Long progress;

    /*
     * Gets the Job correlation data.
     */
    private Map jobCorrelationData;

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

    /**
     * Get the label property: Gets the Job output label.
     * 
     * @return the label value.
     */
    public String getLabel() {
        return this.label;
    }

    /**
     * Set the label property: Gets the Job output label.
     * 
     * @param label the label value to set.
     * @return the MediaJobOutputProgressEventData object itself.
     */
    public MediaJobOutputProgressEventData setLabel(String label) {
        this.label = label;
        return this;
    }

    /**
     * Get the progress property: Gets the Job output progress.
     * 
     * @return the progress value.
     */
    public Long getProgress() {
        return this.progress;
    }

    /**
     * Set the progress property: Gets the Job output progress.
     * 
     * @param progress the progress value to set.
     * @return the MediaJobOutputProgressEventData object itself.
     */
    public MediaJobOutputProgressEventData setProgress(Long progress) {
        this.progress = progress;
        return this;
    }

    /**
     * Get the jobCorrelationData property: Gets the Job correlation data.
     * 
     * @return the jobCorrelationData value.
     */
    public Map getJobCorrelationData() {
        return this.jobCorrelationData;
    }

    /**
     * Set the jobCorrelationData property: Gets the Job correlation data.
     * 
     * @param jobCorrelationData the jobCorrelationData value to set.
     * @return the MediaJobOutputProgressEventData object itself.
     */
    public MediaJobOutputProgressEventData setJobCorrelationData(Map jobCorrelationData) {
        this.jobCorrelationData = jobCorrelationData;
        return this;
    }

    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("label", this.label);
        jsonWriter.writeNumberField("progress", this.progress);
        jsonWriter.writeMapField("jobCorrelationData", this.jobCorrelationData,
            (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("label".equals(fieldName)) {
                    deserializedMediaJobOutputProgressEventData.label = reader.getString();
                } else if ("progress".equals(fieldName)) {
                    deserializedMediaJobOutputProgressEventData.progress = reader.getNullable(JsonReader::getLong);
                } else if ("jobCorrelationData".equals(fieldName)) {
                    Map jobCorrelationData = reader.readMap(reader1 -> reader1.getString());
                    deserializedMediaJobOutputProgressEventData.jobCorrelationData = jobCorrelationData;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedMediaJobOutputProgressEventData;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy