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

com.azure.resourcemanager.mediaservices.fluent.models.TransformProperties 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.fluent.models;

import com.azure.core.annotation.Fluent;
import com.azure.core.util.CoreUtils;
import com.azure.core.util.logging.ClientLogger;
import com.azure.json.JsonReader;
import com.azure.json.JsonSerializable;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import com.azure.resourcemanager.mediaservices.models.TransformOutput;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.util.List;

/**
 * A Transform.
 */
@Fluent
public final class TransformProperties implements JsonSerializable {
    /*
     * The UTC date and time when the Transform was created, in 'YYYY-MM-DDThh:mm:ssZ' format.
     */
    private OffsetDateTime created;

    /*
     * An optional verbose description of the Transform.
     */
    private String description;

    /*
     * The UTC date and time when the Transform was last updated, in 'YYYY-MM-DDThh:mm:ssZ' format.
     */
    private OffsetDateTime lastModified;

    /*
     * An array of one or more TransformOutputs that the Transform should generate.
     */
    private List outputs;

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

    /**
     * Get the created property: The UTC date and time when the Transform was created, in 'YYYY-MM-DDThh:mm:ssZ' format.
     * 
     * @return the created value.
     */
    public OffsetDateTime created() {
        return this.created;
    }

    /**
     * Get the description property: An optional verbose description of the Transform.
     * 
     * @return the description value.
     */
    public String description() {
        return this.description;
    }

    /**
     * Set the description property: An optional verbose description of the Transform.
     * 
     * @param description the description value to set.
     * @return the TransformProperties object itself.
     */
    public TransformProperties withDescription(String description) {
        this.description = description;
        return this;
    }

    /**
     * Get the lastModified property: The UTC date and time when the Transform was last updated, in
     * 'YYYY-MM-DDThh:mm:ssZ' format.
     * 
     * @return the lastModified value.
     */
    public OffsetDateTime lastModified() {
        return this.lastModified;
    }

    /**
     * Get the outputs property: An array of one or more TransformOutputs that the Transform should generate.
     * 
     * @return the outputs value.
     */
    public List outputs() {
        return this.outputs;
    }

    /**
     * Set the outputs property: An array of one or more TransformOutputs that the Transform should generate.
     * 
     * @param outputs the outputs value to set.
     * @return the TransformProperties object itself.
     */
    public TransformProperties withOutputs(List outputs) {
        this.outputs = outputs;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (outputs() == null) {
            throw LOGGER.atError()
                .log(new IllegalArgumentException("Missing required property outputs in model TransformProperties"));
        } else {
            outputs().forEach(e -> e.validate());
        }
    }

    private static final ClientLogger LOGGER = new ClientLogger(TransformProperties.class);

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeArrayField("outputs", this.outputs, (writer, element) -> writer.writeJson(element));
        jsonWriter.writeStringField("description", this.description);
        return jsonWriter.writeEndObject();
    }

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

                if ("outputs".equals(fieldName)) {
                    List outputs = reader.readArray(reader1 -> TransformOutput.fromJson(reader1));
                    deserializedTransformProperties.outputs = outputs;
                } else if ("created".equals(fieldName)) {
                    deserializedTransformProperties.created = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("description".equals(fieldName)) {
                    deserializedTransformProperties.description = reader.getString();
                } else if ("lastModified".equals(fieldName)) {
                    deserializedTransformProperties.lastModified = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedTransformProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy