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

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

import com.azure.core.annotation.Fluent;
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 java.io.IOException;
import java.util.List;

/**
 * The live event input.
 */
@Fluent
public final class LiveEventInput implements JsonSerializable {
    /*
     * The input protocol for the live event. This is specified at creation time and cannot be updated.
     */
    private LiveEventInputProtocol streamingProtocol;

    /*
     * Access control for live event input.
     */
    private LiveEventInputAccessControl accessControl;

    /*
     * ISO 8601 time duration of the key frame interval duration of the input. This value sets the EXT-X-TARGETDURATION
     * property in the HLS output. For example, use PT2S to indicate 2 seconds. Leave the value empty for encoding live
     * events.
     */
    private String keyFrameIntervalDuration;

    /*
     * A UUID in string form to uniquely identify the stream. This can be specified at creation time but cannot be
     * updated. If omitted, the service will generate a unique value.
     */
    private String accessToken;

    /*
     * The input endpoints for the live event.
     */
    private List endpoints;

    /*
     * The metadata endpoints for the live event.
     */
    private List timedMetadataEndpoints;

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

    /**
     * Get the streamingProtocol property: The input protocol for the live event. This is specified at creation time and
     * cannot be updated.
     * 
     * @return the streamingProtocol value.
     */
    public LiveEventInputProtocol streamingProtocol() {
        return this.streamingProtocol;
    }

    /**
     * Set the streamingProtocol property: The input protocol for the live event. This is specified at creation time and
     * cannot be updated.
     * 
     * @param streamingProtocol the streamingProtocol value to set.
     * @return the LiveEventInput object itself.
     */
    public LiveEventInput withStreamingProtocol(LiveEventInputProtocol streamingProtocol) {
        this.streamingProtocol = streamingProtocol;
        return this;
    }

    /**
     * Get the accessControl property: Access control for live event input.
     * 
     * @return the accessControl value.
     */
    public LiveEventInputAccessControl accessControl() {
        return this.accessControl;
    }

    /**
     * Set the accessControl property: Access control for live event input.
     * 
     * @param accessControl the accessControl value to set.
     * @return the LiveEventInput object itself.
     */
    public LiveEventInput withAccessControl(LiveEventInputAccessControl accessControl) {
        this.accessControl = accessControl;
        return this;
    }

    /**
     * Get the keyFrameIntervalDuration property: ISO 8601 time duration of the key frame interval duration of the
     * input. This value sets the EXT-X-TARGETDURATION property in the HLS output. For example, use PT2S to indicate 2
     * seconds. Leave the value empty for encoding live events.
     * 
     * @return the keyFrameIntervalDuration value.
     */
    public String keyFrameIntervalDuration() {
        return this.keyFrameIntervalDuration;
    }

    /**
     * Set the keyFrameIntervalDuration property: ISO 8601 time duration of the key frame interval duration of the
     * input. This value sets the EXT-X-TARGETDURATION property in the HLS output. For example, use PT2S to indicate 2
     * seconds. Leave the value empty for encoding live events.
     * 
     * @param keyFrameIntervalDuration the keyFrameIntervalDuration value to set.
     * @return the LiveEventInput object itself.
     */
    public LiveEventInput withKeyFrameIntervalDuration(String keyFrameIntervalDuration) {
        this.keyFrameIntervalDuration = keyFrameIntervalDuration;
        return this;
    }

    /**
     * Get the accessToken property: A UUID in string form to uniquely identify the stream. This can be specified at
     * creation time but cannot be updated. If omitted, the service will generate a unique value.
     * 
     * @return the accessToken value.
     */
    public String accessToken() {
        return this.accessToken;
    }

    /**
     * Set the accessToken property: A UUID in string form to uniquely identify the stream. This can be specified at
     * creation time but cannot be updated. If omitted, the service will generate a unique value.
     * 
     * @param accessToken the accessToken value to set.
     * @return the LiveEventInput object itself.
     */
    public LiveEventInput withAccessToken(String accessToken) {
        this.accessToken = accessToken;
        return this;
    }

    /**
     * Get the endpoints property: The input endpoints for the live event.
     * 
     * @return the endpoints value.
     */
    public List endpoints() {
        return this.endpoints;
    }

    /**
     * Set the endpoints property: The input endpoints for the live event.
     * 
     * @param endpoints the endpoints value to set.
     * @return the LiveEventInput object itself.
     */
    public LiveEventInput withEndpoints(List endpoints) {
        this.endpoints = endpoints;
        return this;
    }

    /**
     * Get the timedMetadataEndpoints property: The metadata endpoints for the live event.
     * 
     * @return the timedMetadataEndpoints value.
     */
    public List timedMetadataEndpoints() {
        return this.timedMetadataEndpoints;
    }

    /**
     * Set the timedMetadataEndpoints property: The metadata endpoints for the live event.
     * 
     * @param timedMetadataEndpoints the timedMetadataEndpoints value to set.
     * @return the LiveEventInput object itself.
     */
    public LiveEventInput withTimedMetadataEndpoints(List timedMetadataEndpoints) {
        this.timedMetadataEndpoints = timedMetadataEndpoints;
        return this;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("streamingProtocol",
            this.streamingProtocol == null ? null : this.streamingProtocol.toString());
        jsonWriter.writeJsonField("accessControl", this.accessControl);
        jsonWriter.writeStringField("keyFrameIntervalDuration", this.keyFrameIntervalDuration);
        jsonWriter.writeStringField("accessToken", this.accessToken);
        jsonWriter.writeArrayField("endpoints", this.endpoints, (writer, element) -> writer.writeJson(element));
        jsonWriter.writeArrayField("timedMetadataEndpoints", this.timedMetadataEndpoints,
            (writer, element) -> writer.writeJson(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("streamingProtocol".equals(fieldName)) {
                    deserializedLiveEventInput.streamingProtocol
                        = LiveEventInputProtocol.fromString(reader.getString());
                } else if ("accessControl".equals(fieldName)) {
                    deserializedLiveEventInput.accessControl = LiveEventInputAccessControl.fromJson(reader);
                } else if ("keyFrameIntervalDuration".equals(fieldName)) {
                    deserializedLiveEventInput.keyFrameIntervalDuration = reader.getString();
                } else if ("accessToken".equals(fieldName)) {
                    deserializedLiveEventInput.accessToken = reader.getString();
                } else if ("endpoints".equals(fieldName)) {
                    List endpoints
                        = reader.readArray(reader1 -> LiveEventEndpoint.fromJson(reader1));
                    deserializedLiveEventInput.endpoints = endpoints;
                } else if ("timedMetadataEndpoints".equals(fieldName)) {
                    List timedMetadataEndpoints
                        = reader.readArray(reader1 -> LiveEventTimedMetadataEndpoint.fromJson(reader1));
                    deserializedLiveEventInput.timedMetadataEndpoints = timedMetadataEndpoints;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedLiveEventInput;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy