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.kms.model; 15 16 import java.util.EnumSet; 17 import java.util.Map; 18 import java.util.Set; 19 import software.amazon.awssdk.annotations.Generated; 20 import software.amazon.awssdk.utils.internal.EnumUtils; 21 22 @Generated("software.amazon.awssdk:codegen") 23 public enum OriginType { 24 AWS_KMS("AWS_KMS"), 25 26 EXTERNAL("EXTERNAL"), 27 28 AWS_CLOUDHSM("AWS_CLOUDHSM"), 29 30 EXTERNAL_KEY_STORE("EXTERNAL_KEY_STORE"), 31 32 UNKNOWN_TO_SDK_VERSION(null); 33 34 private static final Map<String, OriginType> VALUE_MAP = EnumUtils.uniqueIndex(OriginType.class, OriginType::toString); 35 36 private final String value; 37 OriginType(String value)38 private OriginType(String value) { 39 this.value = value; 40 } 41 42 @Override toString()43 public String toString() { 44 return String.valueOf(value); 45 } 46 47 /** 48 * Use this in place of valueOf to convert the raw string returned by the service into the enum value. 49 * 50 * @param value 51 * real value 52 * @return OriginType corresponding to the value 53 */ fromValue(String value)54 public static OriginType fromValue(String value) { 55 if (value == null) { 56 return null; 57 } 58 return VALUE_MAP.getOrDefault(value, UNKNOWN_TO_SDK_VERSION); 59 } 60 61 /** 62 * Use this in place of {@link #values()} to return a {@link Set} of all values known to the SDK. This will return 63 * all known enum values except {@link #UNKNOWN_TO_SDK_VERSION}. 64 * 65 * @return a {@link Set} of known {@link OriginType}s 66 */ knownValues()67 public static Set<OriginType> knownValues() { 68 Set<OriginType> knownValues = EnumSet.allOf(OriginType.class); 69 knownValues.remove(UNKNOWN_TO_SDK_VERSION); 70 return knownValues; 71 } 72 } 73