Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
    /**
     * The quota types.
     */
    public enum QuotaType {
        CONSUMER_BYTE_RATE,
        PRODUCER_BYTE_RATE,
        REQUEST_PERCENTAGE,
    }

    /**
     * The quota configuration for a specific user and client ID.
     */
    public class QuotaConfig {

        /**
         * Where in the hierarchyHow the quota is applied to the quota value was specifiedentity.
         */
        public enum SourceEntity {
            USER,        // InThe order of descending precedenceuser principal.
            USERCLIENT_CLIENTID,   // The client ID.
            // /config/users/<user>/clients/<client-id> Others may be added in the future.
        }

    USER_DEFAULT_CLIENT,    /**
      // /config/users/<user>/clients/<default>
  * How the quota is applied to the quota entity.
 USER,        */
        public enum Behavior {
      // /config/users/<user>
            DEFAULT_USER_CLIENT,      SET,        // Sets the value, overwriting and lower precedence SET values.
            RESTRICT,   // Adds a limit (upper bound) to higher precedence values.
            // Others may be added in the future.
        }

        /**
         * The units for the quota.
         */
        public enum Units {
            BPS,   // /config/users/<default>/clients/<client-id>
         // Bytes  DEFAULT_USER_DEFAULT_CLIENT,  // /config/users/<default>/clients/<default>per second, on a global scale.
            DEFAULTBPS_PER_USERBROKER,  // Bytes per second, on a per-broker level.
        // /config/users/<default>
   SHARE,         CLIENT,  // The shares, used for determining proportional quota.
        }

       // /config/clients/<client-id>**
            DEFAULT_CLIENT,       * Information about a specific quota configuration value.
        // /config/clients/<default> */
        public class Value {
 DEFAULT,           /**
           // static default
* @param source the entity source for the }
value
        /**
     * @param behavior the *behavior Informationfor aboutapplying athe quota
 value.
          */
  * @param units the units to publicapply classto Valuethe {value
             /**
 @param value the non-null value
         * @param source the source*/
 for the value
         public Value(Map<Entity, String> source, *Behavior @parambehavior, valueUnits the non-nullunits, Double value);
            public Map<Entity,  */String> source();
            public Behavior Value(Source source, Double valuebehavior();
            public SourceUnits sourceunits();
            public Double value();
        }

        /**
         * Information about the value for a quota type.
         */
        public class Entry {
            /**
             * @param value the active quota value
             * @param overriddenValues list of all values lower that are ignored due to being lower in the hierarchy
             */
            public Entry(Value value, List<Value> overriddenValues);
            public Value value();
            public List<Value> overriddenValues();
        }

        /**
         * Maps quota type to its configuration entry.
         *
         * Note that, depending upon the settings in the request's options, this config may not map every
         * quota type to an entry. If a key is not contained in the map, then that quota type's value
         * is not specified.
         */
        public Map<QuotaType, Entry> config();
    }

    /**
     * Identifies a quota entity. forIf a given user and client ID. If the provided user or client ID is
     * `Optional.empty()` entity key type has a value, then it's a specified name,
     * if the value is the empty string, then the default name is used, otherwise if null, then the namekey is omitted
     * entirely.omitted Ator leastthe onevalue ofis usernull, orthen clientthe IDname mustis beomitted specifiedentirely.
     *
     * For example:
     *
     *   {user="kafka-user", clientId="kafka-client-id"} corresponds to quota source `USER_CLIENT` with
     *   specified user "kafka-user" and client ID "kafka-client-id".
     *
     *   {user="kafka-user", clientId=Optional.empty()} corresponds to quota source `USER_DEFAULT_CLIENT`
     *   with specified user "kafka-user" and default client ID.
     *
     *   {user=null, clientId="kafka-client-id"} corresponds to quota source `CLIENT` for client with
     *   ID "kafka-client-id".
     */
    public class QuotaEntity {
        public QuotaEntity(Optional<String> userMap<Entity, Optional<String>String> clientIdentity);
        public Optional<String> user();
        public Optional<String> clientId();
    }

    public class DescribeQuotasOptions {
        // Whether to include the inherited values in the result. If false, then undefined values for
        // the config entries will be ommitted in the results.
        //
        // Default: true.
        DescribeQuotasOptions setWantInheritedValues(boolean wantInheritedValues);

        // Whether to include the overridden values for every quota type in the result.
        //
        // Default: true.
        DescribeQuotasOptions setWantOverriddenValues(boolean wantOverriddenValues);
    }

    public class DescribeQuotasResult {
        Map<QuotaEntity, QuotaConfig> configs;
    }

    public interface Admin extends AutoCloseable {
        /**
         * Describes the quotas for the provided entities.
         */
        DescribeQuotasResult describeQuotas(Collection<QuotaEntity> quotaEntities);
    }

...