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.hbase.client.security;
019
020import org.apache.yetus.audience.InterfaceAudience;
021
022/**
023 * Available security capabilities
024 */
025@InterfaceAudience.Public
026public enum SecurityCapability {
027  // Note to implementors: These must match the numbering of Capability values in MasterProtos
028  SIMPLE_AUTHENTICATION(0),
029  SECURE_AUTHENTICATION(1),
030  AUTHORIZATION(2),
031  CELL_AUTHORIZATION(3),
032  CELL_VISIBILITY(4);
033
034  private final int value;
035
036  public int getValue() {
037    return value;
038  }
039
040  public String getName() {
041    return toString();
042  }
043
044  private SecurityCapability(int value) {
045    this.value = value;
046  }
047
048  public static SecurityCapability valueOf(int value) {
049    switch (value) {
050      case 0:
051        return SIMPLE_AUTHENTICATION;
052      case 1:
053        return SECURE_AUTHENTICATION;
054      case 2:
055        return AUTHORIZATION;
056      case 3:
057        return CELL_AUTHORIZATION;
058      case 4:
059        return CELL_VISIBILITY;
060      default:
061        throw new IllegalArgumentException("Unknown SecurityCapability value " + value);
062    }
063  }
064}