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 ObjectCannedACL {
24 PRIVATE("private"),
25
26 PUBLIC_READ("public-read"),
27
28 PUBLIC_READ_WRITE("public-read-write"),
29
30 AUTHENTICATED_READ("authenticated-read"),
31
32 AWS_EXEC_READ("aws-exec-read"),
33
34 BUCKET_OWNER_READ("bucket-owner-read"),
35
36 BUCKET_OWNER_FULL_CONTROL("bucket-owner-full-control"),
37
38 UNKNOWN_TO_SDK_VERSION(null);
39
40 private final String value;
41
42 private ObjectCannedACL(String value) {
43 this.value = value;
44 }
45
46 @Override
47 public String toString() {
48 return String.valueOf(value);
49 }
50
51 /**
52 * Use this in place of valueOf to convert the raw string returned by the service into the enum value.
53 *
54 * @param value
55 * real value
56 * @return ObjectCannedACL corresponding to the value
57 */
58 public static ObjectCannedACL fromValue(String value) {
59 if (value == null) {
60 return null;
61 }
62 return Stream.of(ObjectCannedACL.values()).filter(e -> e.toString().equals(value)).findFirst()
63 .orElse(UNKNOWN_TO_SDK_VERSION);
64 }
65
66 /**
67 * Use this in place of {@link #values()} to return a {@link Set} of all values known to the SDK. This will return
68 * all known enum values except {@link #UNKNOWN_TO_SDK_VERSION}.
69 *
70 * @return a {@link Set} of known {@link ObjectCannedACL}s
71 */
72 public static Set<ObjectCannedACL> knownValues() {
73 return Stream.of(values()).filter(v -> v != UNKNOWN_TO_SDK_VERSION).collect(toSet());
74 }
75 }
76