001/*
002 * Copyright 2012-2018 Ping Identity Corporation
003 * All Rights Reserved.
004 */
005/*
006 * Copyright (C) 2015-2018 Ping Identity Corporation
007 *
008 * This program is free software; you can redistribute it and/or modify
009 * it under the terms of the GNU General Public License (GPLv2 only)
010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
011 * as published by the Free Software Foundation.
012 *
013 * This program is distributed in the hope that it will be useful,
014 * but WITHOUT ANY WARRANTY; without even the implied warranty of
015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
016 * GNU General Public License for more details.
017 *
018 * You should have received a copy of the GNU General Public License
019 * along with this program; if not, see <http://www.gnu.org/licenses>.
020 */
021package com.unboundid.ldap.sdk.unboundidds.controls;
022
023
024
025import com.unboundid.ldap.sdk.Control;
026import com.unboundid.ldap.sdk.LDAPException;
027import com.unboundid.ldap.sdk.ResultCode;
028import com.unboundid.util.NotMutable;
029import com.unboundid.util.ThreadSafety;
030import com.unboundid.util.ThreadSafetyLevel;
031
032import static com.unboundid.ldap.sdk.unboundidds.controls.ControlMessages.*;
033
034
035
036/**
037 * This class provides a request control which may be used to request that the
038 * server return resource limit information for the authenticated user in the
039 * response to a successful bind operation.  Resource limits that may be
040 * returned include custom size limit, time limit, idle time limit, lookthrough
041 * limit, equivalent authorization user DN, client connection policy name, and
042 * privilege names.
043 * <BR>
044 * <BLOCKQUOTE>
045 *   <B>NOTE:</B>  This class, and other classes within the
046 *   {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only
047 *   supported for use against Ping Identity, UnboundID, and
048 *   Nokia/Alcatel-Lucent 8661 server products.  These classes provide support
049 *   for proprietary functionality or for external specifications that are not
050 *   considered stable or mature enough to be guaranteed to work in an
051 *   interoperable way with other types of LDAP servers.
052 * </BLOCKQUOTE>
053 * <BR>
054 * This control does not have a value.  The criticality may be either
055 * {@code true} or {@code false}.
056 *
057 * @see GetUserResourceLimitsResponseControl
058 */
059@NotMutable()
060@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE)
061public final class GetUserResourceLimitsRequestControl
062       extends Control
063{
064  /**
065   * The OID (1.3.6.1.4.1.30221.2.5.25) for the get user resource limits request
066   * control.
067   */
068  public static final String GET_USER_RESOURCE_LIMITS_REQUEST_OID =
069       "1.3.6.1.4.1.30221.2.5.25";
070
071
072
073  /**
074   * The serial version UID for this serializable class.
075   */
076  private static final long serialVersionUID = 3355139762944763749L;
077
078
079
080  /**
081   * Creates a new get user resource limits request control.  It will not be
082   * marked critical.
083   */
084  public GetUserResourceLimitsRequestControl()
085  {
086    this(false);
087  }
088
089
090
091  /**
092   * Creates a new get user resource limits request control with the specified
093   * criticality.
094   *
095   * @param  isCritical  Indicates whether this control should be marked
096   *                     critical.
097   */
098  public GetUserResourceLimitsRequestControl(final boolean isCritical)
099  {
100    super(GET_USER_RESOURCE_LIMITS_REQUEST_OID, isCritical,  null);
101  }
102
103
104
105  /**
106   * Creates a new get user resource limits request control which is decoded
107   * from the provided generic control.
108   *
109   * @param  control  The generic control to be decoded as a get user resource
110   *                  limits request control.
111   *
112   * @throws  LDAPException  If the provided control cannot be decoded as a get
113   *                         user resource limits request control.
114   */
115  public GetUserResourceLimitsRequestControl(final Control control)
116         throws LDAPException
117  {
118    super(control);
119
120    if (control.hasValue())
121    {
122      throw new LDAPException(ResultCode.DECODING_ERROR,
123           ERR_GET_USER_RESOURCE_LIMITS_REQUEST_HAS_VALUE.get());
124    }
125  }
126
127
128
129  /**
130   * {@inheritDoc}
131   */
132  @Override()
133  public String getControlName()
134  {
135    return INFO_CONTROL_NAME_GET_USER_RESOURCE_LIMITS_REQUEST.get();
136  }
137
138
139
140  /**
141   * {@inheritDoc}
142   */
143  @Override()
144  public void toString(final StringBuilder buffer)
145  {
146    buffer.append("GetUserResourceLimitsRequestControl(isCritical=");
147    buffer.append(isCritical());
148    buffer.append(')');
149  }
150}