com.azure.resourcemanager.mediaservices.models.JobInputAsset 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.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.List;
/**
* Represents an Asset for input into a Job.
*/
@Fluent
public final class JobInputAsset extends JobInputClip {
/*
* The discriminator for derived types.
*/
private String odataType = "#Microsoft.Media.JobInputAsset";
/*
* The name of the input Asset.
*/
private String assetName;
/**
* Creates an instance of JobInputAsset class.
*/
public JobInputAsset() {
}
/**
* Get the odataType property: The discriminator for derived types.
*
* @return the odataType value.
*/
@Override
public String odataType() {
return this.odataType;
}
/**
* Get the assetName property: The name of the input Asset.
*
* @return the assetName value.
*/
public String assetName() {
return this.assetName;
}
/**
* Set the assetName property: The name of the input Asset.
*
* @param assetName the assetName value to set.
* @return the JobInputAsset object itself.
*/
public JobInputAsset withAssetName(String assetName) {
this.assetName = assetName;
return this;
}
/**
* {@inheritDoc}
*/
@Override
public JobInputAsset withFiles(List files) {
super.withFiles(files);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public JobInputAsset withStart(ClipTime start) {
super.withStart(start);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public JobInputAsset withEnd(ClipTime end) {
super.withEnd(end);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public JobInputAsset withLabel(String label) {
super.withLabel(label);
return this;
}
/**
* {@inheritDoc}
*/
@Override
public JobInputAsset withInputDefinitions(List inputDefinitions) {
super.withInputDefinitions(inputDefinitions);
return this;
}
/**
* Validates the instance.
*
* @throws IllegalArgumentException thrown if the instance is not valid.
*/
@Override
public void validate() {
if (assetName() == null) {
throw LOGGER.atError()
.log(new IllegalArgumentException("Missing required property assetName in model JobInputAsset"));
}
if (start() != null) {
start().validate();
}
if (end() != null) {
end().validate();
}
if (inputDefinitions() != null) {
inputDefinitions().forEach(e -> e.validate());
}
}
private static final ClientLogger LOGGER = new ClientLogger(JobInputAsset.class);
/**
* {@inheritDoc}
*/
@Override
public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
jsonWriter.writeStartObject();
jsonWriter.writeArrayField("files", files(), (writer, element) -> writer.writeString(element));
jsonWriter.writeJsonField("start", start());
jsonWriter.writeJsonField("end", end());
jsonWriter.writeStringField("label", label());
jsonWriter.writeArrayField("inputDefinitions", inputDefinitions(),
(writer, element) -> writer.writeJson(element));
jsonWriter.writeStringField("assetName", this.assetName);
jsonWriter.writeStringField("@odata.type", this.odataType);
return jsonWriter.writeEndObject();
}
/**
* Reads an instance of JobInputAsset from the JsonReader.
*
* @param jsonReader The JsonReader being read.
* @return An instance of JobInputAsset if the JsonReader was pointing to an instance of it, or null if it was
* pointing to JSON null.
* @throws IllegalStateException If the deserialized JSON object was missing any required properties.
* @throws IOException If an error occurs while reading the JobInputAsset.
*/
public static JobInputAsset fromJson(JsonReader jsonReader) throws IOException {
return jsonReader.readObject(reader -> {
JobInputAsset deserializedJobInputAsset = new JobInputAsset();
while (reader.nextToken() != JsonToken.END_OBJECT) {
String fieldName = reader.getFieldName();
reader.nextToken();
if ("files".equals(fieldName)) {
List files = reader.readArray(reader1 -> reader1.getString());
deserializedJobInputAsset.withFiles(files);
} else if ("start".equals(fieldName)) {
deserializedJobInputAsset.withStart(ClipTime.fromJson(reader));
} else if ("end".equals(fieldName)) {
deserializedJobInputAsset.withEnd(ClipTime.fromJson(reader));
} else if ("label".equals(fieldName)) {
deserializedJobInputAsset.withLabel(reader.getString());
} else if ("inputDefinitions".equals(fieldName)) {
List inputDefinitions
= reader.readArray(reader1 -> InputDefinition.fromJson(reader1));
deserializedJobInputAsset.withInputDefinitions(inputDefinitions);
} else if ("assetName".equals(fieldName)) {
deserializedJobInputAsset.assetName = reader.getString();
} else if ("@odata.type".equals(fieldName)) {
deserializedJobInputAsset.odataType = reader.getString();
} else {
reader.skipChildren();
}
}
return deserializedJobInputAsset;
});
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy