
software.amazon.awssdk.services.elastictranscoder.model.HlsContentProtection 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 HLS content protection settings, if any, that you want Elastic Transcoder to apply to your output files.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class HlsContentProtection implements SdkPojo, Serializable,
ToCopyableBuilder {
private static final SdkField METHOD_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Method")
.getter(getter(HlsContentProtection::method)).setter(setter(Builder::method))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Method").build()).build();
private static final SdkField KEY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Key")
.getter(getter(HlsContentProtection::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(HlsContentProtection::keyMd5)).setter(setter(Builder::keyMd5))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KeyMd5").build()).build();
private static final SdkField INITIALIZATION_VECTOR_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("InitializationVector").getter(getter(HlsContentProtection::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(HlsContentProtection::licenseAcquisitionUrl))
.setter(setter(Builder::licenseAcquisitionUrl))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LicenseAcquisitionUrl").build())
.build();
private static final SdkField KEY_STORAGE_POLICY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("KeyStoragePolicy").getter(getter(HlsContentProtection::keyStoragePolicy))
.setter(setter(Builder::keyStoragePolicy))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("KeyStoragePolicy").build()).build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(METHOD_FIELD, KEY_FIELD,
KEY_MD5_FIELD, INITIALIZATION_VECTOR_FIELD, LICENSE_ACQUISITION_URL_FIELD, KEY_STORAGE_POLICY_FIELD));
private static final long serialVersionUID = 1L;
private final String method;
private final String key;
private final String keyMd5;
private final String initializationVector;
private final String licenseAcquisitionUrl;
private final String keyStoragePolicy;
private HlsContentProtection(BuilderImpl builder) {
this.method = builder.method;
this.key = builder.key;
this.keyMd5 = builder.keyMd5;
this.initializationVector = builder.initializationVector;
this.licenseAcquisitionUrl = builder.licenseAcquisitionUrl;
this.keyStoragePolicy = builder.keyStoragePolicy;
}
/**
*
* The content protection method for your output. The only valid value is: aes-128
.
*
*
* This value is written into the method attribute of the EXT-X-KEY
metadata tag in the output
* playlist.
*
*
* @return The content protection method for your output. The only valid value is: aes-128
.
*
* This value is written into the method attribute of the EXT-X-KEY
metadata tag in the output
* playlist.
*/
public final String method() {
return method;
}
/**
*
* If you want Elastic Transcoder to generate a key for you, leave this field blank.
*
*
* If you choose to supply your own key, you must encrypt the key by using AWS KMS. The key must be base64-encoded,
* and it must be one of the following bit lengths before being base64-encoded:
*
*
* 128
, 192
, or 256
.
*
*
* @return If you want Elastic Transcoder to generate a key for you, leave this field blank.
*
* If you choose to supply your own key, you must encrypt the key by using AWS KMS. The key must be
* base64-encoded, and it must be one of the following bit lengths before being base64-encoded:
*
*
* 128
, 192
, or 256
.
*/
public final String key() {
return key;
}
/**
*
* If Elastic Transcoder is generating your key for you, you must leave this field blank.
*
*
* The MD5 digest of the key that you want Elastic Transcoder to use to encrypt your output 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 If Elastic Transcoder is generating your key for you, you must leave this field blank.
*
* The MD5 digest of the key that you want Elastic Transcoder to use to encrypt your output 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;
}
/**
*
* If Elastic Transcoder is generating your key for you, you must leave this field blank.
*
*
* 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 output files. The initialization vector must be base64-encoded, and it
* must be exactly 16 bytes before being base64-encoded.
*
*
* @return If Elastic Transcoder is generating your key for you, you must leave this field blank.
*
* 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 output files. The initialization vector must be
* base64-encoded, and it must be exactly 16 bytes before being base64-encoded.
*/
public final String initializationVector() {
return initializationVector;
}
/**
*
* The location of the license key required to decrypt your HLS playlist. The URL must be an absolute path, and is
* referenced in the URI attribute of the EXT-X-KEY metadata tag in the playlist file.
*
*
* @return The location of the license key required to decrypt your HLS playlist. The URL must be an absolute path,
* and is referenced in the URI attribute of the EXT-X-KEY metadata tag in the playlist file.
*/
public final String licenseAcquisitionUrl() {
return licenseAcquisitionUrl;
}
/**
*
* Specify whether you want Elastic Transcoder to write your HLS license key to an Amazon S3 bucket. If you choose
* WithVariantPlaylists
, LicenseAcquisitionUrl
must be left blank and Elastic Transcoder
* writes your data key into the same bucket as the associated playlist.
*
*
* @return Specify whether you want Elastic Transcoder to write your HLS license key to an Amazon S3 bucket. If you
* choose WithVariantPlaylists
, LicenseAcquisitionUrl
must be left blank and
* Elastic Transcoder writes your data key into the same bucket as the associated playlist.
*/
public final String keyStoragePolicy() {
return keyStoragePolicy;
}
@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(method());
hashCode = 31 * hashCode + Objects.hashCode(key());
hashCode = 31 * hashCode + Objects.hashCode(keyMd5());
hashCode = 31 * hashCode + Objects.hashCode(initializationVector());
hashCode = 31 * hashCode + Objects.hashCode(licenseAcquisitionUrl());
hashCode = 31 * hashCode + Objects.hashCode(keyStoragePolicy());
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 HlsContentProtection)) {
return false;
}
HlsContentProtection other = (HlsContentProtection) obj;
return Objects.equals(method(), other.method()) && Objects.equals(key(), other.key())
&& Objects.equals(keyMd5(), other.keyMd5())
&& Objects.equals(initializationVector(), other.initializationVector())
&& Objects.equals(licenseAcquisitionUrl(), other.licenseAcquisitionUrl())
&& Objects.equals(keyStoragePolicy(), other.keyStoragePolicy());
}
/**
* 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("HlsContentProtection").add("Method", method()).add("Key", key()).add("KeyMd5", keyMd5())
.add("InitializationVector", initializationVector()).add("LicenseAcquisitionUrl", licenseAcquisitionUrl())
.add("KeyStoragePolicy", keyStoragePolicy()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Method":
return Optional.ofNullable(clazz.cast(method()));
case "Key":
return Optional.ofNullable(clazz.cast(key()));
case "KeyMd5":
return Optional.ofNullable(clazz.cast(keyMd5()));
case "InitializationVector":
return Optional.ofNullable(clazz.cast(initializationVector()));
case "LicenseAcquisitionUrl":
return Optional.ofNullable(clazz.cast(licenseAcquisitionUrl()));
case "KeyStoragePolicy":
return Optional.ofNullable(clazz.cast(keyStoragePolicy()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function