com.azure.resourcemanager.mediaservices.models.LiveEventIngestion Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of azure-resourcemanager-mediaservices Show documentation
Show all versions of azure-resourcemanager-mediaservices Show documentation
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.Fluent;
import com.azure.core.util.CoreUtils;
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.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
/**
* The live event ingestion telemetry data.
*/
@Fluent
public final class LiveEventIngestion implements JsonSerializable {
/*
* Ingestion stream name.
*/
private String streamName;
/*
* Ingestion begin time in UTC.
*/
private OffsetDateTime begin;
/*
* Ingestion end time in UTC. Empty if it's not stopped yet.
*/
private OffsetDateTime end;
/*
* Reason why ingestion stops. Empty if it's not stopped yet. E.g) Service Stopped. No Ingestion.
*/
private String endReason;
/*
* IngestInterruption entry list.
*/
private List ingestInterruptions;
/**
* Creates an instance of LiveEventIngestion class.
*/
public LiveEventIngestion() {
}
/**
* Get the streamName property: Ingestion stream name.
*
* @return the streamName value.
*/
public String streamName() {
return this.streamName;
}
/**
* Set the streamName property: Ingestion stream name.
*
* @param streamName the streamName value to set.
* @return the LiveEventIngestion object itself.
*/
public LiveEventIngestion withStreamName(String streamName) {
this.streamName = streamName;
return this;
}
/**
* Get the begin property: Ingestion begin time in UTC.
*
* @return the begin value.
*/
public OffsetDateTime begin() {
return this.begin;
}
/**
* Set the begin property: Ingestion begin time in UTC.
*
* @param begin the begin value to set.
* @return the LiveEventIngestion object itself.
*/
public LiveEventIngestion withBegin(OffsetDateTime begin) {
this.begin = begin;
return this;
}
/**
* Get the end property: Ingestion end time in UTC. Empty if it's not stopped yet.
*
* @return the end value.
*/
public OffsetDateTime end() {
return this.end;
}
/**
* Set the end property: Ingestion end time in UTC. Empty if it's not stopped yet.
*
* @param end the end value to set.
* @return the LiveEventIngestion object itself.
*/
public LiveEventIngestion withEnd(OffsetDateTime end) {
this.end = end;
return this;
}
/**
* Get the endReason property: Reason why ingestion stops. Empty if it's not stopped yet. E.g) Service Stopped. No
* Ingestion.
*
* @return the endReason value.
*/
public String endReason() {
return this.endReason;
}
/**
* Set the endReason property: Reason why ingestion stops. Empty if it's not stopped yet. E.g) Service Stopped. No
* Ingestion.
*
* @param endReason the endReason value to set.
* @return the LiveEventIngestion object itself.
*/
public LiveEventIngestion withEndReason(String endReason) {
this.endReason = endReason;
return this;
}
/**
* Get the ingestInterruptions property: IngestInterruption entry list.
*
* @return the ingestInterruptions value.
*/
public List ingestInterruptions() {
return this.ingestInterruptions;
}
/**
* Set the ingestInterruptions property: IngestInterruption entry list.
*
* @param ingestInterruptions the ingestInterruptions value to set.
* @return the LiveEventIngestion object itself.
*/
public LiveEventIngestion withIngestInterruptions(List ingestInterruptions) {
this.ingestInterruptions = ingestInterruptions;
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
public void validate() {
if (ingestInterruptions() != null) {
ingestInterruptions().forEach(e -> e.validate());
}
}
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeStringField("streamName", this.streamName);
jsonWriter.writeStringField("begin",
this.begin == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.begin));
jsonWriter.writeStringField("end",
this.end == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.end));
jsonWriter.writeStringField("endReason", this.endReason);
jsonWriter.writeArrayField("ingestInterruptions", this.ingestInterruptions,
(writer, element) -> writer.writeJson(element));
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of LiveEventIngestion from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of LiveEventIngestion 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 LiveEventIngestion.
*/
public static LiveEventIngestion fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
LiveEventIngestion deserializedLiveEventIngestion = new LiveEventIngestion();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("streamName".equals(fieldName)) {
deserializedLiveEventIngestion.streamName = reader.getString();
} else if ("begin".equals(fieldName)) {
deserializedLiveEventIngestion.begin = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("end".equals(fieldName)) {
deserializedLiveEventIngestion.end = reader
.getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
} else if ("endReason".equals(fieldName)) {
deserializedLiveEventIngestion.endReason = reader.getString();
} else if ("ingestInterruptions".equals(fieldName)) {
List ingestInterruptions
= reader.readArray(reader1 -> LiveEventIngestInterruption.fromJson(reader1));
deserializedLiveEventIngestion.ingestInterruptions = ingestInterruptions;
} else {
reader.skipChildren();
}
}
return deserializedLiveEventIngestion;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy