001/** 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, software 013 * distributed under the License is distributed on an "AS IS" BASIS, 014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 015 * See the License for the specific language governing permissions and 016 * limitations under the License. 017 */ 018package org.apache.hadoop.hdfs.client; 019 020import org.apache.hadoop.classification.InterfaceAudience; 021import org.apache.hadoop.classification.InterfaceStability; 022 023/** 024 * CreateEncryptionZoneFlag is used in 025 * {@link HdfsAdmin#createEncryptionZone(Path, String, EnumSet)} to indicate 026 * what should be done when creating an encryption zone. 027 * 028 * Use CreateEncryptionZoneFlag as follows: 029 * <ol> 030 * <li>PROVISION_TRASH - provision a trash directory for the encryption zone 031 * to support soft delete.</li> 032 * </ol> 033 */ 034@InterfaceAudience.Public 035@InterfaceStability.Evolving 036public enum CreateEncryptionZoneFlag { 037 038 /** 039 * Do not provision a trash directory in the encryption zone. 040 * 041 * @see CreateEncryptionZoneFlag#NO_TRASH 042 */ 043 NO_TRASH((short) 0x00), 044 /** 045 * Provision a trash directory .Trash/ in the 046 * encryption zone. 047 * 048 * @see CreateEncryptionZoneFlag#PROVISION_TRASH 049 */ 050 PROVISION_TRASH((short) 0x01); 051 052 private final short mode; 053 054 CreateEncryptionZoneFlag(short mode) { 055 this.mode = mode; 056 } 057 058 public static CreateEncryptionZoneFlag valueOf(short mode) { 059 for (CreateEncryptionZoneFlag flag : CreateEncryptionZoneFlag.values()) { 060 if (flag.getMode() == mode) { 061 return flag; 062 } 063 } 064 return null; 065 } 066 067 public short getMode() { 068 return mode; 069 } 070} 071