Versions Compared

Key

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

...

Code Block
languagejava
/**
 * Describes a fully-qualified entity.
 */
public class QuotaEntity {
    /**
     * Type of an entity entry.
     */
    public enumstatic Typefinal {
String USER       USER,= "user";
    public static final String CLIENT_ID,
        UNKNOWN;
    }
= "client-id";

    /**
     * Represents the default name for an entity, i.e. the entity that's matched
     * when an exact match isn't found.
     */
    public static final static String QUOTA_ENTITY_NAME_DEFAULT = // implementation defined

    /**
     * `entries` describes the fully-qualified entity. The key is a {@code Type} string, however
     * there may also exist keys that are not enumerated by {@code Type} that still apply, e.g.
     * the server may internally associate another type. When querying entities, it's necessary
     * to return all quota types because quota values for these types may influence the effective
     * quota value. However, when altering a quota, any types that aren't specified must be able
     * to be inferred by the server, otherwise an error is returned.
     *
     * For example, {("CLIENT_ID" -> "test-client"),
     *               ("USER" -> "test-user"),
     *               ("GROUP" -> "internal-group")}.
     */
    public QuotaEntity(Map<String, String> entries);
}

/**
 * Describes a quota key.
 */
public class QuotaKey {
    /**
     * The quota types.
     */
    public enumstatic Typefinal {
        String CONSUMER_BYTE_RATE, = "consumer_byte_rate";
    public static final String PRODUCER_BYTE_RATE, = "producer_byte_rate";
    public static final String REQUEST_PERCENTAGE,
        UNKNOWN;
    }
= "request_percentage";

    /**
     * The units for a quota value. Note there may be multiple units for a given quota type
     * that influences quota behavior.
     */
    public enumstatic Units {
        final String RATE_BPS,
 = //      UNKNOWN;
    }

implementation defined

    /**
     * @param type the quota type
     * @param units the units for the quota type
     */
    public QuotaKey(TypeString type, UnitsString units);
}

/**
 * Describes a quota entity filter.
 */
public class QuotaFilter {
    /**
     * A filter to be applied.
     *
     * @param entityType the entity type the filter applies to
     * @param match the non-null string that's matched exactly
     */
    public QuotaFilter(QuotaEntity.TypeString entityType, String match);
}

...