001/*
002 * Copyright 2021-2024 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright 2021-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) 2021-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.extensions;
037
038
039
040import com.unboundid.asn1.ASN1OctetString;
041import com.unboundid.ldap.sdk.Control;
042import com.unboundid.ldap.sdk.ExtendedRequest;
043import com.unboundid.ldap.sdk.ExtendedResult;
044import com.unboundid.ldap.sdk.LDAPConnection;
045import com.unboundid.ldap.sdk.LDAPException;
046import com.unboundid.ldap.sdk.ResultCode;
047import com.unboundid.util.NotMutable;
048import com.unboundid.util.NotNull;
049import com.unboundid.util.Nullable;
050import com.unboundid.util.ThreadSafety;
051import com.unboundid.util.ThreadSafetyLevel;
052
053import static com.unboundid.ldap.sdk.unboundidds.extensions.ExtOpMessages.*;
054
055
056
057/**
058 * This class defines an extended request that may be used to request that a
059 * Ping Identity Directory Server instance (or related Ping Identity server
060 * product) purge information about any retired listener certificates from its
061 * topology registry.  This extended request has an OID of
062 * 1.3.6.1.4.1.30221.2.6.70 and no value.
063 * <BR>
064 * <BLOCKQUOTE>
065 *   <B>NOTE:</B>  This class, and other classes within the
066 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
067 *   supported for use against Ping Identity, UnboundID, and
068 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
069 *   for proprietary functionality or for external specifications that are not
070 *   considered stable or mature enough to be guaranteed to work in an
071 *   interoperable way with other types of LDAP servers.
072 * </BLOCKQUOTE>
073 *
074 * @see  PurgeRetiredListenerCertificatesExtendedResult
075 */
076@NotMutable()
077@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
078public final class PurgeRetiredListenerCertificatesExtendedRequest
079       extends ExtendedRequest
080{
081  /**
082   * The OID (1.3.6.1.4.1.30221.2.6.70) for the purge retired listener
083   * certificates extended request.
084   */
085  @NotNull public static final String PURGE_RETIRED_LISTENER_CERTS_REQUEST_OID =
086       "1.3.6.1.4.1.30221.2.6.70";
087
088
089
090  /**
091   * The serial version UID for this serializable class.
092   */
093  private static final long serialVersionUID = 3182708156067344907L;
094
095
096
097  /**
098   * Creates a new purge retired listener certificates extended request with the
099   * provided information.
100   *
101   * @param  requestControls  The set of controls to include in the extended
102   *                          request.  It may be {@code null} or empty if no
103   *                          request controls should be included.
104   */
105  public PurgeRetiredListenerCertificatesExtendedRequest(
106              @Nullable final Control... requestControls)
107  {
108    super(PURGE_RETIRED_LISTENER_CERTS_REQUEST_OID, null, requestControls);
109  }
110
111
112
113  /**
114   * Creates a new purge retired listener certificates extended request that is
115   * decoded from the provided generic extended request.
116   *
117   * @param  request  The generic extended request to be decoded as a purge
118   *                  retired listener certificates extended request.  It must
119   *                  not be {@code null}.
120   *
121   * @throws  LDAPException  If a problem occurs while attempting to decode the
122   *                         provided extended request as a purge retired
123   *                         listener certificates request.
124   */
125  public PurgeRetiredListenerCertificatesExtendedRequest(
126              @NotNull final ExtendedRequest request)
127         throws LDAPException
128  {
129    super(request);
130
131    final ASN1OctetString value = request.getValue();
132    if (value != null)
133    {
134      throw new LDAPException(ResultCode.DECODING_ERROR,
135           ERR_PURGE_RETIRED_LISTENER_CERTS_REQ_HAS_VALUE.get());
136    }
137  }
138
139
140
141  /**
142   * {@inheritDoc}
143   */
144  @Override()
145  @NotNull()
146  public PurgeRetiredListenerCertificatesExtendedResult process(
147              @NotNull final LDAPConnection connection, final int depth)
148         throws LDAPException
149  {
150    final ExtendedResult extendedResponse = super.process(connection, depth);
151    return new PurgeRetiredListenerCertificatesExtendedResult(extendedResponse);
152  }
153
154
155
156  /**
157   * {@inheritDoc}
158   */
159  @Override()
160  @NotNull()
161  public String getExtendedRequestName()
162  {
163    return INFO_PURGE_RETIRED_LISTENER_CERTS_REQUEST_NAME.get();
164  }
165
166
167
168  /**
169   * {@inheritDoc}
170   */
171  @Override()
172  public void toString(@NotNull final StringBuilder buffer)
173  {
174    buffer.append("PurgeRetiredListenerCertificatesExtendedRequest(oid='");
175    buffer.append(getOID());
176    buffer.append('\'');
177
178    final Control[] controls = getControls();
179    if (controls.length > 0)
180    {
181      buffer.append(", controls={");
182      for (int i=0; i < controls.length; i++)
183      {
184        if (i > 0)
185        {
186          buffer.append(", ");
187        }
188
189        buffer.append(controls[i]);
190      }
191      buffer.append('}');
192    }
193
194    buffer.append(')');
195  }
196}