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 MultiRegionKeyType { 24 PRIMARY("PRIMARY"), 25 26 REPLICA("REPLICA"), 27 28 UNKNOWN_TO_SDK_VERSION(null); 29 30 private static final Map<String, MultiRegionKeyType> VALUE_MAP = EnumUtils.uniqueIndex(MultiRegionKeyType.class, 31 MultiRegionKeyType::toString); 32 33 private final String value; 34 MultiRegionKeyType(String value)35 private MultiRegionKeyType(String value) { 36 this.value = value; 37 } 38 39 @Override toString()40 public String toString() { 41 return String.valueOf(value); 42 } 43 44 /** 45 * Use this in place of valueOf to convert the raw string returned by the service into the enum value. 46 * 47 * @param value 48 * real value 49 * @return MultiRegionKeyType corresponding to the value 50 */ fromValue(String value)51 public static MultiRegionKeyType fromValue(String value) { 52 if (value == null) { 53 return null; 54 } 55 return VALUE_MAP.getOrDefault(value, UNKNOWN_TO_SDK_VERSION); 56 } 57 58 /** 59 * Use this in place of {@link #values()} to return a {@link Set} of all values known to the SDK. This will return 60 * all known enum values except {@link #UNKNOWN_TO_SDK_VERSION}. 61 * 62 * @return a {@link Set} of known {@link MultiRegionKeyType}s 63 */ knownValues()64 public static Set<MultiRegionKeyType> knownValues() { 65 Set<MultiRegionKeyType> knownValues = EnumSet.allOf(MultiRegionKeyType.class); 66 knownValues.remove(UNKNOWN_TO_SDK_VERSION); 67 return knownValues; 68 } 69 } 70