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 inter-server certificates from
061 * its topology registry.  This extended request has an OID of
062 * 1.3.6.1.4.1.30221.2.6.71 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  PurgeRetiredInterServerCertificatesExtendedResult
075 */
076@NotMutable()
077@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
078public final class PurgeRetiredInterServerCertificatesExtendedRequest
079       extends ExtendedRequest
080{
081  /**
082   * The OID (1.3.6.1.4.1.30221.2.6.71) for the purge retired inter-server
083   * certificates extended request.
084   */
085  @NotNull public static final String
086       PURGE_RETIRED_INTER_SERVER_CERTS_REQUEST_OID =
087            "1.3.6.1.4.1.30221.2.6.71";
088
089
090
091  /**
092   * The serial version UID for this serializable class.
093   */
094  private static final long serialVersionUID = 2390802711515142192L;
095
096
097
098  /**
099   * Creates a new purge retired inter-server certificates extended request with
100   * the provided information.
101   *
102   * @param  requestControls  The set of controls to include in the extended
103   *                          request.  It may be {@code null} or empty if no
104   *                          request controls should be included.
105   */
106  public PurgeRetiredInterServerCertificatesExtendedRequest(
107              @Nullable final Control... requestControls)
108  {
109    super(PURGE_RETIRED_INTER_SERVER_CERTS_REQUEST_OID, null, requestControls);
110  }
111
112
113
114  /**
115   * Creates a new purge retired inter-server certificates extended request that
116   * is decoded from the provided generic extended request.
117   *
118   * @param  request  The generic extended request to be decoded as a purge
119   *                  retired inter-server certificates extended request.  It
120   *                  must not be {@code null}.
121   *
122   * @throws  LDAPException  If a problem occurs while attempting to decode the
123   *                         provided extended request as a purge retired
124   *                         inter-server certificates request.
125   */
126  public PurgeRetiredInterServerCertificatesExtendedRequest(
127              @NotNull final ExtendedRequest request)
128         throws LDAPException
129  {
130    super(request);
131
132    final ASN1OctetString value = request.getValue();
133    if (value != null)
134    {
135      throw new LDAPException(ResultCode.DECODING_ERROR,
136           ERR_PURGE_RETIRED_INTER_SERVER_CERTS_REQ_HAS_VALUE.get());
137    }
138  }
139
140
141
142  /**
143   * {@inheritDoc}
144   */
145  @Override()
146  @NotNull()
147  public PurgeRetiredInterServerCertificatesExtendedResult process(
148              @NotNull final LDAPConnection connection, final int depth)
149         throws LDAPException
150  {
151    final ExtendedResult extendedResponse = super.process(connection, depth);
152    return new PurgeRetiredInterServerCertificatesExtendedResult(
153         extendedResponse);
154  }
155
156
157
158  /**
159   * {@inheritDoc}
160   */
161  @Override()
162  @NotNull()
163  public String getExtendedRequestName()
164  {
165    return INFO_PURGE_RETIRED_INTER_SERVER_CERTS_REQUEST_NAME.get();
166  }
167
168
169
170  /**
171   * {@inheritDoc}
172   */
173  @Override()
174  public void toString(@NotNull final StringBuilder buffer)
175  {
176    buffer.append("PurgeRetiredInterServerCertificatesExtendedRequest(oid='");
177    buffer.append(getOID());
178    buffer.append('\'');
179
180    final Control[] controls = getControls();
181    if (controls.length > 0)
182    {
183      buffer.append(", controls={");
184      for (int i=0; i < controls.length; i++)
185      {
186        if (i > 0)
187        {
188          buffer.append(", ");
189        }
190
191        buffer.append(controls[i]);
192      }
193      buffer.append('}');
194    }
195
196    buffer.append(')');
197  }
198}