
software.amazon.awssdk.services.elastictranscoder.model.PlayReadyDrm Maven / Gradle / Ivy
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
* the License. A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
* CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
* and limitations under the License.
*/
package software.amazon.awssdk.services.elastictranscoder.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* The PlayReady DRM settings, if any, that you want Elastic Transcoder to apply to the output files associated with
* this playlist.
*
*
* PlayReady DRM encrypts your media files using aes-ctr
encryption.
*
*
* If you use DRM for an HLSv3
playlist, your outputs must have a master playlist.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class PlayReadyDrm implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField FORMAT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Format")
.getter(getter(PlayReadyDrm::format)).setter(setter(Builder::format))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Format").build()).build();
private static final SdkField KEY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Key")
.getter(getter(PlayReadyDrm::key)).setter(setter(Builder::key))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Key").build()).build();
private static final SdkField KEY_MD5_FIELD = SdkField. builder(MarshallingType.STRING).memberName("KeyMd5")
.getter(getter(PlayReadyDrm::keyMd5)).setter(setter(Builder::keyMd5))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KeyMd5").build()).build();
private static final SdkField KEY_ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("KeyId")
.getter(getter(PlayReadyDrm::keyId)).setter(setter(Builder::keyId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KeyId").build()).build();
private static final SdkField INITIALIZATION_VECTOR_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InitializationVector").getter(getter(PlayReadyDrm::initializationVector))
.setter(setter(Builder::initializationVector))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InitializationVector").build())
.build();
private static final SdkField LICENSE_ACQUISITION_URL_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LicenseAcquisitionUrl").getter(getter(PlayReadyDrm::licenseAcquisitionUrl))
.setter(setter(Builder::licenseAcquisitionUrl))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LicenseAcquisitionUrl").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(FORMAT_FIELD, KEY_FIELD,
KEY_MD5_FIELD, KEY_ID_FIELD, INITIALIZATION_VECTOR_FIELD, LICENSE_ACQUISITION_URL_FIELD));
private static final long serialVersionUID = 1L;
private final String format;
private final String key;
private final String keyMd5;
private final String keyId;
private final String initializationVector;
private final String licenseAcquisitionUrl;
private PlayReadyDrm(BuilderImpl builder) {
this.format = builder.format;
this.key = builder.key;
this.keyMd5 = builder.keyMd5;
this.keyId = builder.keyId;
this.initializationVector = builder.initializationVector;
this.licenseAcquisitionUrl = builder.licenseAcquisitionUrl;
}
/**
*
* The type of DRM, if any, that you want Elastic Transcoder to apply to the output files associated with this
* playlist.
*
*
* @return The type of DRM, if any, that you want Elastic Transcoder to apply to the output files associated with
* this playlist.
*/
public final String format() {
return format;
}
/**
*
* The DRM key for your file, provided by your DRM license provider. The key must be base64-encoded, and it must be
* one of the following bit lengths before being base64-encoded:
*
*
* 128
, 192
, or 256
.
*
*
* The key must also be encrypted by using AWS KMS.
*
*
* @return The DRM key for your file, provided by your DRM license provider. The key must be base64-encoded, and it
* must be one of the following bit lengths before being base64-encoded:
*
* 128
, 192
, or 256
.
*
*
* The key must also be encrypted by using AWS KMS.
*/
public final String key() {
return key;
}
/**
*
* The MD5 digest of the key used for DRM on your file, and that you want Elastic Transcoder to use as a checksum to
* make sure your key was not corrupted in transit. The key MD5 must be base64-encoded, and it must be exactly 16
* bytes before being base64-encoded.
*
*
* @return The MD5 digest of the key used for DRM on your file, and that you want Elastic Transcoder to use as a
* checksum to make sure your key was not corrupted in transit. The key MD5 must be base64-encoded, and it
* must be exactly 16 bytes before being base64-encoded.
*/
public final String keyMd5() {
return keyMd5;
}
/**
*
* The ID for your DRM key, so that your DRM license provider knows which key to provide.
*
*
* The key ID must be provided in big endian, and Elastic Transcoder converts it to little endian before inserting
* it into the PlayReady DRM headers. If you are unsure whether your license server provides your key ID in big or
* little endian, check with your DRM provider.
*
*
* @return The ID for your DRM key, so that your DRM license provider knows which key to provide.
*
* The key ID must be provided in big endian, and Elastic Transcoder converts it to little endian before
* inserting it into the PlayReady DRM headers. If you are unsure whether your license server provides your
* key ID in big or little endian, check with your DRM provider.
*/
public final String keyId() {
return keyId;
}
/**
*
* The series of random bits created by a random bit generator, unique for every encryption operation, that you want
* Elastic Transcoder to use to encrypt your files. The initialization vector must be base64-encoded, and it must be
* exactly 8 bytes long before being base64-encoded. If no initialization vector is provided, Elastic Transcoder
* generates one for you.
*
*
* @return The series of random bits created by a random bit generator, unique for every encryption operation, that
* you want Elastic Transcoder to use to encrypt your files. The initialization vector must be
* base64-encoded, and it must be exactly 8 bytes long before being base64-encoded. If no initialization
* vector is provided, Elastic Transcoder generates one for you.
*/
public final String initializationVector() {
return initializationVector;
}
/**
*
* The location of the license key required to play DRM content. The URL must be an absolute path, and is referenced
* by the PlayReady header. The PlayReady header is referenced in the protection header of the client manifest for
* Smooth Streaming outputs, and in the EXT-X-DXDRM and EXT-XDXDRMINFO metadata tags for HLS playlist outputs. An
* example URL looks like this: https://www.example.com/exampleKey/
*
*
* @return The location of the license key required to play DRM content. The URL must be an absolute path, and is
* referenced by the PlayReady header. The PlayReady header is referenced in the protection header of the
* client manifest for Smooth Streaming outputs, and in the EXT-X-DXDRM and EXT-XDXDRMINFO metadata tags for
* HLS playlist outputs. An example URL looks like this: https://www.example.com/exampleKey/
*/
public final String licenseAcquisitionUrl() {
return licenseAcquisitionUrl;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(format());
hashCode = 31 * hashCode + Objects.hashCode(key());
hashCode = 31 * hashCode + Objects.hashCode(keyMd5());
hashCode = 31 * hashCode + Objects.hashCode(keyId());
hashCode = 31 * hashCode + Objects.hashCode(initializationVector());
hashCode = 31 * hashCode + Objects.hashCode(licenseAcquisitionUrl());
return hashCode;
}
@Override
public final boolean equals(Object obj) {
return equalsBySdkFields(obj);
}
@Override
public final boolean equalsBySdkFields(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof PlayReadyDrm)) {
return false;
}
PlayReadyDrm other = (PlayReadyDrm) obj;
return Objects.equals(format(), other.format()) && Objects.equals(key(), other.key())
&& Objects.equals(keyMd5(), other.keyMd5()) && Objects.equals(keyId(), other.keyId())
&& Objects.equals(initializationVector(), other.initializationVector())
&& Objects.equals(licenseAcquisitionUrl(), other.licenseAcquisitionUrl());
}
/**
* Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be
* redacted from this string using a placeholder value.
*/
@Override
public final String toString() {
return ToString.builder("PlayReadyDrm").add("Format", format()).add("Key", key()).add("KeyMd5", keyMd5())
.add("KeyId", keyId()).add("InitializationVector", initializationVector())
.add("LicenseAcquisitionUrl", licenseAcquisitionUrl()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Format":
return Optional.ofNullable(clazz.cast(format()));
case "Key":
return Optional.ofNullable(clazz.cast(key()));
case "KeyMd5":
return Optional.ofNullable(clazz.cast(keyMd5()));
case "KeyId":
return Optional.ofNullable(clazz.cast(keyId()));
case "InitializationVector":
return Optional.ofNullable(clazz.cast(initializationVector()));
case "LicenseAcquisitionUrl":
return Optional.ofNullable(clazz.cast(licenseAcquisitionUrl()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function