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

org.apache.hadoop.fs.CosNEncryptionMethods Maven / Gradle / Ivy

Go to download

This module contains code to support integration with Tencent Cloud COS. It also declares the dependencies needed to work with COS.

There is a newer version: 8.2.7
Show newest version
package org.apache.hadoop.fs;

import com.qcloud.cos.utils.StringUtils;

import java.io.IOException;

public enum CosNEncryptionMethods {

    SSE_COS("SSE-COS", true),
    SSE_C("SSE-C", true),
    SSE_KMS("SSE-KMS", true),
    NONE("", false);

    static final String UNKNOWN_ALGORITHM_MESSAGE
            = "COSN unknown the encryption algorithm ";

    private String method;
    private boolean serverSide;

    CosNEncryptionMethods(String method, final boolean serverSide) {
        this.method = method;
        this.serverSide = serverSide;
    }

    public String getMethod() {
        return method;
    }

    /**
     * Get the encryption mechanism from the value provided.
     * @param name algorithm name
     * @return the method
     * @throws IOException if the algorithm is unknown
     */
    public static CosNEncryptionMethods getMethod(String name) throws IOException {
        if (StringUtils.isNullOrEmpty(name)) {
            return NONE;
        }
        for (CosNEncryptionMethods v : values()) {
            if (v.getMethod().equals(name)) {
                return v;
            }
        }
        throw new IOException(UNKNOWN_ALGORITHM_MESSAGE + name);
    }

    /**
     * Flag to indicate this is a server-side encryption option.
     * @return true if this is server side.
     */
    public boolean isServerSide() {
        return serverSide;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy