com.qcloud.cos.model.SSEAlgorithm Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cos_api Show documentation
Show all versions of cos_api Show documentation
qcloud cos sdk for inner tencentyun
The newest version!
package com.qcloud.cos.model;
/**
* Server-side Encryption Algorithm.
*/
public enum SSEAlgorithm {
AES256("AES256"),
KMS("COS:kms"),
;
private final String algorithm;
public String getAlgorithm() {
return algorithm;
}
private SSEAlgorithm(String algorithm) {
this.algorithm = algorithm;
}
@Override
public String toString() {
return algorithm;
}
/**
* Returns the SSEAlgorithm enum corresponding to the given string;
* or null if and only if the given algorithm is null.
*
* @throws IllegalArgumentException if the specified algorithm is not
* supported.
*/
public static SSEAlgorithm fromString(String algorithm) {
if (algorithm == null)
return null;
for (SSEAlgorithm e: values()) {
if (e.getAlgorithm().equals(algorithm))
return e;
}
throw new IllegalArgumentException("Unsupported algorithm " + algorithm);
}
/**
* Returns the default server side encryption algorithm, which is AES256.
*/
public static SSEAlgorithm getDefault() {
return AES256;
}
}