com.azure.messaging.eventgrid.systemevents.MediaJobErroredEventData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-messaging-eventgrid Show documentation
Show all versions of azure-messaging-eventgrid Show documentation
This package contains Microsoft Azure EventGrid SDK.
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.messaging.eventgrid.systemevents;
import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;
import java.util.Map;
/**
* Job error state event data. Schema of the data property of an EventGridEvent for a Microsoft.Media.JobErrored event.
*/
@Fluent
public final class MediaJobErroredEventData extends MediaJobStateChangeEventData {
/*
* Gets the Job outputs.
*/
private List outputs;
/*
* The new state of the Job.
*/
private MediaJobState state;
/*
* The previous state of the Job.
*/
private MediaJobState previousState;
/**
* Creates an instance of MediaJobErroredEventData class.
*/
public MediaJobErroredEventData() {
}
/**
* Get the outputs property: Gets the Job outputs.
*
* @return the outputs value.
*/
public List getOutputs() {
return this.outputs;
}
/**
* Set the outputs property: Gets the Job outputs.
*
* @param outputs the outputs value to set.
* @return the MediaJobErroredEventData object itself.
*/
public MediaJobErroredEventData setOutputs(List outputs) {
this.outputs = outputs;
return this;
}
/**
* Get the state property: The new state of the Job.
*
* @return the state value.
*/
@Override
public MediaJobState getState() {
return this.state;
}
/**
* Get the previousState property: The previous state of the Job.
*
* @return the previousState value.
*/
@Override
public MediaJobState getPreviousState() {
return this.previousState;
}
/**
* {@inheritDoc}
*/
@Override
public MediaJobErroredEventData setCorrelationData(Map correlationData) {
super.setCorrelationData(correlationData);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeMapField("correlationData", getCorrelationData(),
(writer, element) -> writer.writeString(element));
jsonWriter.writeArrayField("outputs", this.outputs, (writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of MediaJobErroredEventData from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of MediaJobErroredEventData 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 MediaJobErroredEventData.
*/
public static MediaJobErroredEventData fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
MediaJobErroredEventData deserializedMediaJobErroredEventData = new MediaJobErroredEventData();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("previousState".equals(fieldName)) {
deserializedMediaJobErroredEventData.previousState = MediaJobState.fromString(reader.getString());
} else if ("state".equals(fieldName)) {
deserializedMediaJobErroredEventData.state = MediaJobState.fromString(reader.getString());
} else if ("correlationData".equals(fieldName)) {
Map correlationData = reader.readMap(reader1 -> reader1.getString());
deserializedMediaJobErroredEventData.setCorrelationData(correlationData);
} else if ("outputs".equals(fieldName)) {
List outputs = reader.readArray(reader1 -> MediaJobOutput.fromJson(reader1));
deserializedMediaJobErroredEventData.outputs = outputs;
} else {
reader.skipChildren();
}
}
return deserializedMediaJobErroredEventData;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy