001/*
002 * Copyright 2020 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2020 Ping Identity Corporation
007 *
008 * Licensed under the Apache License, Version 2.0 (the "License");
009 * you may not use this file except in compliance with the License.
010 * You may obtain a copy of the License at
011 *
012 *    http://www.apache.org/licenses/LICENSE-2.0
013 *
014 * Unless required by applicable law or agreed to in writing, software
015 * distributed under the License is distributed on an "AS IS" BASIS,
016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017 * See the License for the specific language governing permissions and
018 * limitations under the License.
019 */
020/*
021 * Copyright (C) 2020 Ping Identity Corporation
022 *
023 * This program is free software; you can redistribute it and/or modify
024 * it under the terms of the GNU General Public License (GPLv2 only)
025 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
026 * as published by the Free Software Foundation.
027 *
028 * This program is distributed in the hope that it will be useful,
029 * but WITHOUT ANY WARRANTY; without even the implied warranty of
030 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
031 * GNU General Public License for more details.
032 *
033 * You should have received a copy of the GNU General Public License
034 * along with this program; if not, see <http://www.gnu.org/licenses>.
035 */
036package com.unboundid.ldap.sdk.unboundidds.tasks;
037
038
039
040import com.unboundid.util.StaticUtils;
041import com.unboundid.util.ThreadSafety;
042import com.unboundid.util.ThreadSafetyLevel;
043
044
045
046/**
047 * This enum defines the security level values that may be used in conjunction
048 * with the collect-support-data tool (and the corresponding administrative
049 * task and extended operation).
050 * <BR>
051 * <BLOCKQUOTE>
052 *   <B>NOTE:</B>  This class, and other classes within the
053 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
054 *   supported for use against Ping Identity, UnboundID, and
055 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
056 *   for proprietary functionality or for external specifications that are not
057 *   considered stable or mature enough to be guaranteed to work in an
058 *   interoperable way with other types of LDAP servers.
059 * </BLOCKQUOTE>
060 */
061@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
062public enum CollectSupportDataSecurityLevel
063{
064  // NOTICE:  If new items are added in the future, then enum values should be
065  // sorted
066
067
068
069  /**
070   * The security level that indicates that no data should be obscured or
071   * redacted.
072   */
073  NONE("none"),
074
075
076
077  /**
078   * The security level that indicates that secret information (like the values
079   * of sensitive configuration properties) should be obscured, and that logs
080   * containing user data (like the data recovery log) will be excluded from the
081   * support data archive.
082   */
083  OBSCURE_SECRETS("obscure-secrets"),
084
085
086
087  /**
088   * The security level that includes everything in the {@link #OBSCURE_SECRETS}
089   * level, but takes even more drastic measures to avoid capturing any
090   * personally identifiable information, including excluding access logs from
091   * the archive and obscuring values in entry DNs and search filters.
092   */
093  MAXIMUM("maximum");
094
095
096
097  // The name used to identify this security level.
098  private final String name;
099
100
101
102  /**
103   * Creates a new collect support data security level with the provided name.
104   *
105   * @param  name  The name used to identify this security level.
106   */
107  CollectSupportDataSecurityLevel(final String name)
108  {
109    this.name = name;
110  }
111
112
113
114  /**
115   * Retrieves the name used to identify this security level.
116   *
117   * @return  The name used to identify this security level.
118   */
119  public String getName()
120  {
121    return name;
122  }
123
124
125
126  /**
127   * Retrieves the collect support data security level with the given name.
128   *
129   * @param  name  The name for the collect support data security level to
130   *               retrieve.  It must not be {@code null}.
131   *
132   * @return  The collect support data security level with the given name, or
133   *          {@code null} if there is no security level with the provided name.
134   */
135  public static CollectSupportDataSecurityLevel forName(final String name)
136  {
137    final String normalizedName =
138         StaticUtils.toLowerCase(name).replace('_', '-');
139    for (final CollectSupportDataSecurityLevel l : values())
140    {
141      if (normalizedName.equals(l.name))
142      {
143        return l;
144      }
145    }
146
147    return null;
148  }
149
150
151
152  /**
153   * Retrieves a string representation of this collect support data security
154   * level.
155   *
156   * @return  A string representation of this collect support data security
157   *          level.
158   */
159  @Override()
160  public String toString()
161  {
162    return name;
163  }
164}