software.amazon.awssdk.services.elastictranscoder.model.Encryption Maven / Gradle / Ivy
Show all versions of elastictranscoder Show documentation
/*
* 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 encryption settings, if any, that are used for decrypting your input files or encrypting your output files. If
* your input file is encrypted, you must specify the mode that Elastic Transcoder uses to decrypt your file, otherwise
* you must specify the mode you want Elastic Transcoder to use to encrypt your output files.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class Encryption implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField MODE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Mode")
.getter(getter(Encryption::mode)).setter(setter(Builder::mode))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Mode").build()).build();
private static final SdkField KEY_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Key")
.getter(getter(Encryption::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(Encryption::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(Encryption::initializationVector))
.setter(setter(Builder::initializationVector))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("InitializationVector").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(MODE_FIELD, KEY_FIELD,
KEY_MD5_FIELD, INITIALIZATION_VECTOR_FIELD));
private static final long serialVersionUID = 1L;
private final String mode;
private final String key;
private final String keyMd5;
private final String initializationVector;
private Encryption(BuilderImpl builder) {
this.mode = builder.mode;
this.key = builder.key;
this.keyMd5 = builder.keyMd5;
this.initializationVector = builder.initializationVector;
}
/**
*
* The specific server-side encryption mode that you want Elastic Transcoder to use when decrypting your input files
* or encrypting your output files. Elastic Transcoder supports the following options:
*
*
* -
*
* s3: Amazon S3 creates and manages the keys used for encrypting your files.
*
*
* -
*
* s3-aws-kms: Amazon S3 calls the Amazon Key Management Service, which creates and manages the keys that are
* used for encrypting your files. If you specify s3-aws-kms
and you don't want to use the default key,
* you must add the AWS-KMS key that you want to use to your pipeline.
*
*
* -
*
* aes-cbc-pkcs7: A padded cipher-block mode of operation originally used for HLS files.
*
*
* -
*
* aes-ctr: AES Counter Mode.
*
*
* -
*
* aes-gcm: AES Galois Counter Mode, a mode of operation that is an authenticated encryption format, meaning
* that a file, key, or initialization vector that has been tampered with fails the decryption process.
*
*
*
*
* For all three AES options, you must provide the following settings, which must be base64-encoded:
*
*
* -
*
* Key
*
*
* -
*
* Key MD5
*
*
* -
*
* Initialization Vector
*
*
*
*
*
* For the AES modes, your private encryption keys and your unencrypted data are never stored by AWS; therefore, it
* is important that you safely manage your encryption keys. If you lose them, you won't be able to unencrypt your
* data.
*
*
*
* @return The specific server-side encryption mode that you want Elastic Transcoder to use when decrypting your
* input files or encrypting your output files. Elastic Transcoder supports the following options:
*
* -
*
* s3: Amazon S3 creates and manages the keys used for encrypting your files.
*
*
* -
*
* s3-aws-kms: Amazon S3 calls the Amazon Key Management Service, which creates and manages the keys
* that are used for encrypting your files. If you specify s3-aws-kms
and you don't want to use
* the default key, you must add the AWS-KMS key that you want to use to your pipeline.
*
*
* -
*
* aes-cbc-pkcs7: A padded cipher-block mode of operation originally used for HLS files.
*
*
* -
*
* aes-ctr: AES Counter Mode.
*
*
* -
*
* aes-gcm: AES Galois Counter Mode, a mode of operation that is an authenticated encryption format,
* meaning that a file, key, or initialization vector that has been tampered with fails the decryption
* process.
*
*
*
*
* For all three AES options, you must provide the following settings, which must be base64-encoded:
*
*
* -
*
* Key
*
*
* -
*
* Key MD5
*
*
* -
*
* Initialization Vector
*
*
*
*
*
* For the AES modes, your private encryption keys and your unencrypted data are never stored by AWS;
* therefore, it is important that you safely manage your encryption keys. If you lose them, you won't be
* able to unencrypt your data.
*
*/
public final String mode() {
return mode;
}
/**
*
* The data encryption key that you want Elastic Transcoder to use to encrypt your output file, or that was used to
* encrypt your input file. 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 the Amazon Key Management Service.
*
*
* @return The data encryption key that you want Elastic Transcoder to use to encrypt your output file, or that was
* used to encrypt your input file. 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 the Amazon Key Management Service.
*/
public final String key() {
return key;
}
/**
*
* The MD5 digest of the key that you used to encrypt your input file, or that you want Elastic Transcoder to use to
* encrypt your output file. Elastic Transcoder uses the key digest 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 long before being
* base64-encoded.
*
*
* @return The MD5 digest of the key that you used to encrypt your input file, or that you want Elastic Transcoder
* to use to encrypt your output file. Elastic Transcoder uses the key digest 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 long before being base64-encoded.
*/
public final String keyMd5() {
return keyMd5;
}
/**
*
* The series of random bits created by a random bit generator, unique for every encryption operation, that you used
* to encrypt your input files or 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 long before being base64-encoded.
*
*
* @return The series of random bits created by a random bit generator, unique for every encryption operation, that
* you used to encrypt your input files or 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 long before
* being base64-encoded.
*/
public final String initializationVector() {
return initializationVector;
}
@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(mode());
hashCode = 31 * hashCode + Objects.hashCode(key());
hashCode = 31 * hashCode + Objects.hashCode(keyMd5());
hashCode = 31 * hashCode + Objects.hashCode(initializationVector());
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 Encryption)) {
return false;
}
Encryption other = (Encryption) obj;
return Objects.equals(mode(), other.mode()) && Objects.equals(key(), other.key())
&& Objects.equals(keyMd5(), other.keyMd5())
&& Objects.equals(initializationVector(), other.initializationVector());
}
/**
* 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("Encryption").add("Mode", mode()).add("Key", key()).add("KeyMd5", keyMd5())
.add("InitializationVector", initializationVector()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Mode":
return Optional.ofNullable(clazz.cast(mode()));
case "Key":
return Optional.ofNullable(clazz.cast(key()));
case "KeyMd5":
return Optional.ofNullable(clazz.cast(keyMd5()));
case "InitializationVector":
return Optional.ofNullable(clazz.cast(initializationVector()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function