com.ionoscloud.s3.messages.SseAlgorithm Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ionos-cloud-sdk-s3 Show documentation
Show all versions of ionos-cloud-sdk-s3 Show documentation
IONOS Java SDK for Amazon S3 Compatible Cloud Storage
The newest version!
package com.ionoscloud.s3.messages;
import com.fasterxml.jackson.annotation.JsonCreator;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.convert.Convert;
import org.simpleframework.xml.convert.Converter;
import org.simpleframework.xml.stream.InputNode;
import org.simpleframework.xml.stream.OutputNode;
/** Server-side encryption algorithm. */
@Root(name = "SSEAlgorithm")
@Convert(SseAlgorithm.SseAlgorithmConverter.class)
public enum SseAlgorithm {
AES256("AES256"),
AWS_KMS("aws:kms");
private final String value;
private SseAlgorithm(String value) {
this.value = value;
}
public String toString() {
return this.value;
}
/** Returns SseAlgorithm of given string. */
@JsonCreator
public static SseAlgorithm fromString(String sseAlgorithmString) {
for (SseAlgorithm sa : SseAlgorithm.values()) {
if (sseAlgorithmString.equals(sa.value)) {
return sa;
}
}
throw new IllegalArgumentException("unknown SSE algorithm '" + sseAlgorithmString + "'");
}
/** XML converter class. */
public static class SseAlgorithmConverter implements Converter {
@Override
public SseAlgorithm read(InputNode node) throws Exception {
return SseAlgorithm.fromString(node.getValue());
}
@Override
public void write(OutputNode node, SseAlgorithm sseAlgorithm) throws Exception {
node.setValue(sseAlgorithm.toString());
}
}
}