1 /*
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
5 * the License. A copy of the License is located at
6 *
7 * http://aws.amazon.com/apache2.0
8 *
9 * or in the "license" file accompanying this file. This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
10 * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions
11 * and limitations under the License.
12 */
13
14 package software.amazon.awssdk.services.s3.model;
15
16 import static java.util.stream.Collectors.toSet;
17
18 import java.util.Set;
19 import java.util.stream.Stream;
20 import software.amazon.awssdk.annotations.Generated;
21
22 @Generated("software.amazon.awssdk:codegen")
23 public enum ServerSideEncryption {
24 AES256("AES256"),
25
26 AWS_KMS("aws:kms"),
27
28 UNKNOWN_TO_SDK_VERSION(null);
29
30 private final String value;
31
32 private ServerSideEncryption(String value) {
33 this.value = value;
34 }
35
36 @Override
37 public String toString() {
38 return String.valueOf(value);
39 }
40
41 /**
42 * Use this in place of valueOf to convert the raw string returned by the service into the enum value.
43 *
44 * @param value
45 * real value
46 * @return ServerSideEncryption corresponding to the value
47 */
48 public static ServerSideEncryption fromValue(String value) {
49 if (value == null) {
50 return null;
51 }
52 return Stream.of(ServerSideEncryption.values()).filter(e -> e.toString().equals(value)).findFirst()
53 .orElse(UNKNOWN_TO_SDK_VERSION);
54 }
55
56 /**
57 * Use this in place of {@link #values()} to return a {@link Set} of all values known to the SDK. This will return
58 * all known enum values except {@link #UNKNOWN_TO_SDK_VERSION}.
59 *
60 * @return a {@link Set} of known {@link ServerSideEncryption}s
61 */
62 public static Set<ServerSideEncryption> knownValues() {
63 return Stream.of(values()).filter(v -> v != UNKNOWN_TO_SDK_VERSION).collect(toSet());
64 }
65 }
66