001/*
002 * Copyright 2020-2024 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2020-2024 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-2024 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.NotNull;
042import com.unboundid.util.Nullable;
043import com.unboundid.util.ThreadSafety;
044import com.unboundid.util.ThreadSafetyLevel;
045
046
047
048/**
049 * This enum defines the security level values that may be used in conjunction
050 * with the collect-support-data tool (and the corresponding administrative
051 * task and extended operation).
052 * <BR>
053 * <BLOCKQUOTE>
054 *   <B>NOTE:</B>  This class, and other classes within the
055 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
056 *   supported for use against Ping Identity, UnboundID, and
057 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
058 *   for proprietary functionality or for external specifications that are not
059 *   considered stable or mature enough to be guaranteed to work in an
060 *   interoperable way with other types of LDAP servers.
061 * </BLOCKQUOTE>
062 */
063@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
064public enum CollectSupportDataSecurityLevel
065{
066  // NOTICE:  If new items are added in the future, then enum values should be
067  // sorted
068
069
070
071  /**
072   * The security level that indicates that no data should be obscured or
073   * redacted.
074   */
075  NONE("none"),
076
077
078
079  /**
080   * The security level that indicates that secret information (like the values
081   * of sensitive configuration properties) should be obscured, and that logs
082   * containing user data (like the data recovery log) will be excluded from the
083   * support data archive.
084   */
085  OBSCURE_SECRETS("obscure-secrets"),
086
087
088
089  /**
090   * The security level that includes everything in the {@link #OBSCURE_SECRETS}
091   * level, but takes even more drastic measures to avoid capturing any
092   * personally identifiable information, including excluding access logs from
093   * the archive and obscuring values in entry DNs and search filters.
094   */
095  MAXIMUM("maximum");
096
097
098
099  // The name used to identify this security level.
100  @NotNull private final String name;
101
102
103
104  /**
105   * Creates a new collect support data security level with the provided name.
106   *
107   * @param  name  The name used to identify this security level.
108   */
109  CollectSupportDataSecurityLevel(@NotNull final String name)
110  {
111    this.name = name;
112  }
113
114
115
116  /**
117   * Retrieves the name used to identify this security level.
118   *
119   * @return  The name used to identify this security level.
120   */
121  @NotNull()
122  public String getName()
123  {
124    return name;
125  }
126
127
128
129  /**
130   * Retrieves the collect support data security level with the given name.
131   *
132   * @param  name  The name for the collect support data security level to
133   *               retrieve.  It must not be {@code null}.
134   *
135   * @return  The collect support data security level with the given name, or
136   *          {@code null} if there is no security level with the provided name.
137   */
138  @Nullable()
139  public static CollectSupportDataSecurityLevel forName(
140              @NotNull final String name)
141  {
142    final String normalizedName =
143         StaticUtils.toLowerCase(name).replace('_', '-');
144    for (final CollectSupportDataSecurityLevel l : values())
145    {
146      if (normalizedName.equals(l.name))
147      {
148        return l;
149      }
150    }
151
152    return null;
153  }
154
155
156
157  /**
158   * Retrieves a string representation of this collect support data security
159   * level.
160   *
161   * @return  A string representation of this collect support data security
162   *          level.
163   */
164  @Override()
165  @NotNull()
166  public String toString()
167  {
168    return name;
169  }
170}