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

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

/**
 * Class for EnvelopeEncryption encryption scheme.
 */
@Fluent
public final class EnvelopeEncryption implements JsonSerializable {
    /*
     * Representing supported protocols
     */
    private EnabledProtocols enabledProtocols;

    /*
     * Representing which tracks should not be encrypted
     */
    private List clearTracks;

    /*
     * Representing default content key for each encryption scheme and separate content keys for specific tracks
     */
    private StreamingPolicyContentKeys contentKeys;

    /*
     * Template for the URL of the custom service delivering keys to end user players. Not required when using Azure
     * Media Services for issuing keys. The template supports replaceable tokens that the service will update at runtime
     * with the value specific to the request. The currently supported token values are {AlternativeMediaId}, which is
     * replaced with the value of StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the
     * value of identifier of the key being requested.
     */
    private String customKeyAcquisitionUrlTemplate;

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

    /**
     * Get the enabledProtocols property: Representing supported protocols.
     * 
     * @return the enabledProtocols value.
     */
    public EnabledProtocols enabledProtocols() {
        return this.enabledProtocols;
    }

    /**
     * Set the enabledProtocols property: Representing supported protocols.
     * 
     * @param enabledProtocols the enabledProtocols value to set.
     * @return the EnvelopeEncryption object itself.
     */
    public EnvelopeEncryption withEnabledProtocols(EnabledProtocols enabledProtocols) {
        this.enabledProtocols = enabledProtocols;
        return this;
    }

    /**
     * Get the clearTracks property: Representing which tracks should not be encrypted.
     * 
     * @return the clearTracks value.
     */
    public List clearTracks() {
        return this.clearTracks;
    }

    /**
     * Set the clearTracks property: Representing which tracks should not be encrypted.
     * 
     * @param clearTracks the clearTracks value to set.
     * @return the EnvelopeEncryption object itself.
     */
    public EnvelopeEncryption withClearTracks(List clearTracks) {
        this.clearTracks = clearTracks;
        return this;
    }

    /**
     * Get the contentKeys property: Representing default content key for each encryption scheme and separate content
     * keys for specific tracks.
     * 
     * @return the contentKeys value.
     */
    public StreamingPolicyContentKeys contentKeys() {
        return this.contentKeys;
    }

    /**
     * Set the contentKeys property: Representing default content key for each encryption scheme and separate content
     * keys for specific tracks.
     * 
     * @param contentKeys the contentKeys value to set.
     * @return the EnvelopeEncryption object itself.
     */
    public EnvelopeEncryption withContentKeys(StreamingPolicyContentKeys contentKeys) {
        this.contentKeys = contentKeys;
        return this;
    }

    /**
     * Get the customKeyAcquisitionUrlTemplate property: Template for the URL of the custom service delivering keys to
     * end user players. Not required when using Azure Media Services for issuing keys. The template supports
     * replaceable tokens that the service will update at runtime with the value specific to the request. The currently
     * supported token values are {AlternativeMediaId}, which is replaced with the value of
     * StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of identifier of the
     * key being requested.
     * 
     * @return the customKeyAcquisitionUrlTemplate value.
     */
    public String customKeyAcquisitionUrlTemplate() {
        return this.customKeyAcquisitionUrlTemplate;
    }

    /**
     * Set the customKeyAcquisitionUrlTemplate property: Template for the URL of the custom service delivering keys to
     * end user players. Not required when using Azure Media Services for issuing keys. The template supports
     * replaceable tokens that the service will update at runtime with the value specific to the request. The currently
     * supported token values are {AlternativeMediaId}, which is replaced with the value of
     * StreamingLocatorId.AlternativeMediaId, and {ContentKeyId}, which is replaced with the value of identifier of the
     * key being requested.
     * 
     * @param customKeyAcquisitionUrlTemplate the customKeyAcquisitionUrlTemplate value to set.
     * @return the EnvelopeEncryption object itself.
     */
    public EnvelopeEncryption withCustomKeyAcquisitionUrlTemplate(String customKeyAcquisitionUrlTemplate) {
        this.customKeyAcquisitionUrlTemplate = customKeyAcquisitionUrlTemplate;
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
        if (enabledProtocols() != null) {
            enabledProtocols().validate();
        }
        if (clearTracks() != null) {
            clearTracks().forEach(e -> e.validate());
        }
        if (contentKeys() != null) {
            contentKeys().validate();
        }
    }

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

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

                if ("enabledProtocols".equals(fieldName)) {
                    deserializedEnvelopeEncryption.enabledProtocols = EnabledProtocols.fromJson(reader);
                } else if ("clearTracks".equals(fieldName)) {
                    List clearTracks = reader.readArray(reader1 -> TrackSelection.fromJson(reader1));
                    deserializedEnvelopeEncryption.clearTracks = clearTracks;
                } else if ("contentKeys".equals(fieldName)) {
                    deserializedEnvelopeEncryption.contentKeys = StreamingPolicyContentKeys.fromJson(reader);
                } else if ("customKeyAcquisitionUrlTemplate".equals(fieldName)) {
                    deserializedEnvelopeEncryption.customKeyAcquisitionUrlTemplate = reader.getString();
                } else {
                    reader.skipChildren();
                }
            }

            return deserializedEnvelopeEncryption;
        });
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy