001/**
002 *
003 * Licensed to the Apache Software Foundation (ASF) under one
004 * or more contributor license agreements.  See the NOTICE file
005 * distributed with this work for additional information
006 * regarding copyright ownership.  The ASF licenses this file
007 * to you under the Apache License, Version 2.0 (the
008 * "License"); you may not use this file except in compliance
009 * with the License.  You may obtain a copy of the License at
010 *
011 *     http://www.apache.org/licenses/LICENSE-2.0
012 *
013 * Unless required by applicable law or agreed to in writing, software
014 * distributed under the License is distributed on an "AS IS" BASIS,
015 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
016 * See the License for the specific language governing permissions and
017 * limitations under the License.
018 */
019package org.apache.hadoop.hbase.client.security;
020
021import org.apache.yetus.audience.InterfaceAudience;
022
023/**
024 * Available security capabilities
025 */
026@InterfaceAudience.Public
027public enum SecurityCapability {
028  // Note to implementors: These must match the numbering of Capability values in MasterProtos
029  SIMPLE_AUTHENTICATION(0),
030  SECURE_AUTHENTICATION(1),
031  AUTHORIZATION(2),
032  CELL_AUTHORIZATION(3),
033  CELL_VISIBILITY(4);
034
035  private final int value;
036
037  public int getValue() {
038    return value;
039  }
040
041  public String getName() {
042    return toString();
043  }
044
045  private SecurityCapability(int value) {
046    this.value = value;
047  }
048
049  public static SecurityCapability valueOf(int value) {
050    switch (value) {
051      case 0: return SIMPLE_AUTHENTICATION;
052      case 1: return SECURE_AUTHENTICATION;
053      case 2: return AUTHORIZATION;
054      case 3: return CELL_AUTHORIZATION;
055      case 4: return CELL_VISIBILITY;
056      default:
057        throw new IllegalArgumentException("Unknown SecurityCapability value " + value);
058    }
059  }
060}