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

com.azure.resourcemanager.mediaservices.fluent.models.StreamingLocatorProperties 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.StreamingLocatorContentKey;
import java.io.IOException;
import java.time.OffsetDateTime;
import java.time.format.DateTimeFormatter;
import java.util.List;
import java.util.Objects;
import java.util.UUID;

/**
 * Properties of the Streaming Locator.
 */
@Fluent
public final class StreamingLocatorProperties implements JsonSerializable {
    /*
     * Asset Name
     */
    private String assetName;

    /*
     * The creation time of the Streaming Locator.
     */
    private OffsetDateTime created;

    /*
     * The start time of the Streaming Locator.
     */
    private OffsetDateTime startTime;

    /*
     * The end time of the Streaming Locator.
     */
    private OffsetDateTime endTime;

    /*
     * The StreamingLocatorId of the Streaming Locator.
     */
    private UUID streamingLocatorId;

    /*
     * Name of the Streaming Policy used by this Streaming Locator. Either specify the name of Streaming Policy you
     * created or use one of the predefined Streaming Policies. The predefined Streaming Policies available are:
     * 'Predefined_DownloadOnly', 'Predefined_ClearStreamingOnly', 'Predefined_DownloadAndClearStreaming',
     * 'Predefined_ClearKey', 'Predefined_MultiDrmCencStreaming' and 'Predefined_MultiDrmStreaming'
     */
    private String streamingPolicyName;

    /*
     * Name of the default ContentKeyPolicy used by this Streaming Locator.
     */
    private String defaultContentKeyPolicyName;

    /*
     * The ContentKeys used by this Streaming Locator.
     */
    private List contentKeys;

    /*
     * Alternative Media ID of this Streaming Locator
     */
    private String alternativeMediaId;

    /*
     * A list of asset or account filters which apply to this streaming locator
     */
    private List filters;

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

    /**
     * Get the assetName property: Asset Name.
     * 
     * @return the assetName value.
     */
    public String assetName() {
        return this.assetName;
    }

    /**
     * Set the assetName property: Asset Name.
     * 
     * @param assetName the assetName value to set.
     * @return the StreamingLocatorProperties object itself.
     */
    public StreamingLocatorProperties withAssetName(String assetName) {
        this.assetName = assetName;
        return this;
    }

    /**
     * Get the created property: The creation time of the Streaming Locator.
     * 
     * @return the created value.
     */
    public OffsetDateTime created() {
        return this.created;
    }

    /**
     * Get the startTime property: The start time of the Streaming Locator.
     * 
     * @return the startTime value.
     */
    public OffsetDateTime startTime() {
        return this.startTime;
    }

    /**
     * Set the startTime property: The start time of the Streaming Locator.
     * 
     * @param startTime the startTime value to set.
     * @return the StreamingLocatorProperties object itself.
     */
    public StreamingLocatorProperties withStartTime(OffsetDateTime startTime) {
        this.startTime = startTime;
        return this;
    }

    /**
     * Get the endTime property: The end time of the Streaming Locator.
     * 
     * @return the endTime value.
     */
    public OffsetDateTime endTime() {
        return this.endTime;
    }

    /**
     * Set the endTime property: The end time of the Streaming Locator.
     * 
     * @param endTime the endTime value to set.
     * @return the StreamingLocatorProperties object itself.
     */
    public StreamingLocatorProperties withEndTime(OffsetDateTime endTime) {
        this.endTime = endTime;
        return this;
    }

    /**
     * Get the streamingLocatorId property: The StreamingLocatorId of the Streaming Locator.
     * 
     * @return the streamingLocatorId value.
     */
    public UUID streamingLocatorId() {
        return this.streamingLocatorId;
    }

    /**
     * Set the streamingLocatorId property: The StreamingLocatorId of the Streaming Locator.
     * 
     * @param streamingLocatorId the streamingLocatorId value to set.
     * @return the StreamingLocatorProperties object itself.
     */
    public StreamingLocatorProperties withStreamingLocatorId(UUID streamingLocatorId) {
        this.streamingLocatorId = streamingLocatorId;
        return this;
    }

    /**
     * Get the streamingPolicyName property: Name of the Streaming Policy used by this Streaming Locator. Either specify
     * the name of Streaming Policy you created or use one of the predefined Streaming Policies. The predefined
     * Streaming Policies available are: 'Predefined_DownloadOnly', 'Predefined_ClearStreamingOnly',
     * 'Predefined_DownloadAndClearStreaming', 'Predefined_ClearKey', 'Predefined_MultiDrmCencStreaming' and
     * 'Predefined_MultiDrmStreaming'.
     * 
     * @return the streamingPolicyName value.
     */
    public String streamingPolicyName() {
        return this.streamingPolicyName;
    }

    /**
     * Set the streamingPolicyName property: Name of the Streaming Policy used by this Streaming Locator. Either specify
     * the name of Streaming Policy you created or use one of the predefined Streaming Policies. The predefined
     * Streaming Policies available are: 'Predefined_DownloadOnly', 'Predefined_ClearStreamingOnly',
     * 'Predefined_DownloadAndClearStreaming', 'Predefined_ClearKey', 'Predefined_MultiDrmCencStreaming' and
     * 'Predefined_MultiDrmStreaming'.
     * 
     * @param streamingPolicyName the streamingPolicyName value to set.
     * @return the StreamingLocatorProperties object itself.
     */
    public StreamingLocatorProperties withStreamingPolicyName(String streamingPolicyName) {
        this.streamingPolicyName = streamingPolicyName;
        return this;
    }

    /**
     * Get the defaultContentKeyPolicyName property: Name of the default ContentKeyPolicy used by this Streaming
     * Locator.
     * 
     * @return the defaultContentKeyPolicyName value.
     */
    public String defaultContentKeyPolicyName() {
        return this.defaultContentKeyPolicyName;
    }

    /**
     * Set the defaultContentKeyPolicyName property: Name of the default ContentKeyPolicy used by this Streaming
     * Locator.
     * 
     * @param defaultContentKeyPolicyName the defaultContentKeyPolicyName value to set.
     * @return the StreamingLocatorProperties object itself.
     */
    public StreamingLocatorProperties withDefaultContentKeyPolicyName(String defaultContentKeyPolicyName) {
        this.defaultContentKeyPolicyName = defaultContentKeyPolicyName;
        return this;
    }

    /**
     * Get the contentKeys property: The ContentKeys used by this Streaming Locator.
     * 
     * @return the contentKeys value.
     */
    public List contentKeys() {
        return this.contentKeys;
    }

    /**
     * Set the contentKeys property: The ContentKeys used by this Streaming Locator.
     * 
     * @param contentKeys the contentKeys value to set.
     * @return the StreamingLocatorProperties object itself.
     */
    public StreamingLocatorProperties withContentKeys(List contentKeys) {
        this.contentKeys = contentKeys;
        return this;
    }

    /**
     * Get the alternativeMediaId property: Alternative Media ID of this Streaming Locator.
     * 
     * @return the alternativeMediaId value.
     */
    public String alternativeMediaId() {
        return this.alternativeMediaId;
    }

    /**
     * Set the alternativeMediaId property: Alternative Media ID of this Streaming Locator.
     * 
     * @param alternativeMediaId the alternativeMediaId value to set.
     * @return the StreamingLocatorProperties object itself.
     */
    public StreamingLocatorProperties withAlternativeMediaId(String alternativeMediaId) {
        this.alternativeMediaId = alternativeMediaId;
        return this;
    }

    /**
     * Get the filters property: A list of asset or account filters which apply to this streaming locator.
     * 
     * @return the filters value.
     */
    public List filters() {
        return this.filters;
    }

    /**
     * Set the filters property: A list of asset or account filters which apply to this streaming locator.
     * 
     * @param filters the filters value to set.
     * @return the StreamingLocatorProperties object itself.
     */
    public StreamingLocatorProperties withFilters(List filters) {
        this.filters = filters;
        return this;
    }

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

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

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeStringField("assetName", this.assetName);
        jsonWriter.writeStringField("streamingPolicyName", this.streamingPolicyName);
        jsonWriter.writeStringField("startTime",
            this.startTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.startTime));
        jsonWriter.writeStringField("endTime",
            this.endTime == null ? null : DateTimeFormatter.ISO_OFFSET_DATE_TIME.format(this.endTime));
        jsonWriter.writeStringField("streamingLocatorId", Objects.toString(this.streamingLocatorId, null));
        jsonWriter.writeStringField("defaultContentKeyPolicyName", this.defaultContentKeyPolicyName);
        jsonWriter.writeArrayField("contentKeys", this.contentKeys, (writer, element) -> writer.writeJson(element));
        jsonWriter.writeStringField("alternativeMediaId", this.alternativeMediaId);
        jsonWriter.writeArrayField("filters", this.filters, (writer, element) -> writer.writeString(element));
        return jsonWriter.writeEndObject();
    }

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

                if ("assetName".equals(fieldName)) {
                    deserializedStreamingLocatorProperties.assetName = reader.getString();
                } else if ("streamingPolicyName".equals(fieldName)) {
                    deserializedStreamingLocatorProperties.streamingPolicyName = reader.getString();
                } else if ("created".equals(fieldName)) {
                    deserializedStreamingLocatorProperties.created = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("startTime".equals(fieldName)) {
                    deserializedStreamingLocatorProperties.startTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("endTime".equals(fieldName)) {
                    deserializedStreamingLocatorProperties.endTime = reader
                        .getNullable(nonNullReader -> CoreUtils.parseBestOffsetDateTime(nonNullReader.getString()));
                } else if ("streamingLocatorId".equals(fieldName)) {
                    deserializedStreamingLocatorProperties.streamingLocatorId
                        = reader.getNullable(nonNullReader -> UUID.fromString(nonNullReader.getString()));
                } else if ("defaultContentKeyPolicyName".equals(fieldName)) {
                    deserializedStreamingLocatorProperties.defaultContentKeyPolicyName = reader.getString();
                } else if ("contentKeys".equals(fieldName)) {
                    List contentKeys
                        = reader.readArray(reader1 -> StreamingLocatorContentKey.fromJson(reader1));
                    deserializedStreamingLocatorProperties.contentKeys = contentKeys;
                } else if ("alternativeMediaId".equals(fieldName)) {
                    deserializedStreamingLocatorProperties.alternativeMediaId = reader.getString();
                } else if ("filters".equals(fieldName)) {
                    List filters = reader.readArray(reader1 -> reader1.getString());
                    deserializedStreamingLocatorProperties.filters = filters;
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedStreamingLocatorProperties;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy