THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Code Block |
---|
/** * Represents the default name for an entity, i.e. the entity that's matched * when an exact match isn't found. */ public final static String QUOTA_ENTITY_DEFAULT = // implementation defined /** * Describes an entity type. */ public enum QuotaEntityType { USER, // The user principal. CLIENT_ID, // The client ID. // Note others may be added in the future. } // EXPOSITION ONLY** // // * Describes a fully-qualified entity. The key is a QuotaEntityType*/ string, however there public class QuotaEntity //{ may also exist keys that are not enumerated/** by QuotaEntityType that still apply, e.g. the * //`entries` describes the fully-qualified entity. The key is a QuotaEntityType string, however * there may also exist keys that are not enumerated by QuotaEntityType that still apply, e.g. * the server may internally associate another type. It's necessary to return all quota types // * because quota values for these types may influence the effective quota value. However, // * altering a quota, any types that aren't specified should 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 class QuotaEntity extends Map<String, String> { */ public QuotaEntity(Map<String, String> entries); public Map<String, String> entries(); } /** * The quota types. */ public enum QuotaType { CONSUMER_BYTE_RATE, PRODUCER_BYTE_RATE, REQUEST_PERCENTAGE, // Note others may be added in the future. } /** * The units for a quota value. Note there may be multiple units for a given quota type * that influences quota behavior. REQUEST_PERCENTAGE, // Note others may be added in the future. } /**/ public enum* QuotaUnitsThe { units for a quota RATE_BPS, // Note others may be added in the future, e.g. RATE_BPS_PER_BROKER, SHARES. } value. Note there may be multiple units for a given quota type * that influences quota behavior. */ public classenum QuotaFilterQuotaUnits { public enum Rule { RATE_BPS, // Note others may EXACT,be added in the // exact name matchfuture, e.g. RATE_BPS_PER_BROKER, SHARES. } /** NOT, * Describes //a matchesquota all non-matching names key. */ public class PREFIX,QuotaKey { // matches all names with the given prefix /** //* Note@param otherstype maythe bequota addedtype in the future. * } @param units the units for the quota /**type * A filtering rule to be applied. / public QuotaKey(QuotaType type, QuotaUnits *units); public QuotaType type(); public QuotaUnits units(); } |
Code Block |
---|
* @param entity the entity the rule applies to public *class @paramQuotaFilter rule{ the rule to apply public enum Rule { * @param match the non-null string that's applied by the rule EXACT, // exact name */match public QuotaFilter(QuotaEntity entity, Rule ruleNOT, String match); // matches all public QuotaEntity entity();non-matching names public Rule rule(); PREFIX, // publicmatches String match(); }all names with the given prefix public class DescribeQuotasOptions { // Note others // Default. } may be added in the future. public class DescribeQuotasResult {} /** * MapsA anfiltering entityrule to its configured quota value(s). Note if no value is defined for a quota be applied. * * type@param forentity thatthe entity's config,the thenrule itapplies isto not included in the resulting value map. * @param rule the rule to *apply * *@param @returnmatch the collection of entitiesnon-null string that's matchedapplied by the filterrule */ public QuotaFilter(QuotaEntity KafkaFuture<Map<Map<Stringentity, String>,Rule Map<QuotaTyperule, Double>>>String entities(match); } public QuotaEntity entity(); public interface Admin extends AutoCloseable { Rule rule(); public String match(); /**} public class DescribeQuotasOptions { * Describes all entities matching all provided filters (logical AND) that have at least one // Default. } public class DescribeQuotasResult { * quota value defined./** * Maps an entity to its configured * @param filters filtering rules to apply to matching entitiesquota value(s). Note if no value is defined for a quota * @paramtype optionsfor thethat options to use * @return result containing all matching entitiesentity's config, then it is not included in the resulting value map. */ * DescribeQuotasResult@return describeQuotas(Collection<QuotaFilter> filters, DescribeQuotasOptions options); } |
Code Block |
the collection of entities that matched the filter public class DescribeEffectiveQuotasOptions {*/ KafkaFuture<Map<QuotaEntity, //Map<QuotaKey, Whether to include the list of overridden values for every quota type in the result.Double>>> entities(); } public interface Admin extends AutoCloseable { //** // Default: false. DescribeQuotasOptions setOmitOverriddenValues(boolean omitOverriddenValues); } public class DescribeEffectiveQuotasResult { * Describes all entities matching all provided filters (logical AND) that have at least one * quota value /**defined. * Describes a quota key. * @param filters filtering */ rules to apply to matching entities public class Key { * @param options the options to use /** * @return result containing all matching entities * @param type the quota type */ DescribeQuotasResult describeQuotas(Collection<QuotaFilter> *filters, DescribeQuotasOptions options); } |
Code Block |
---|
public class DescribeEffectiveQuotasOptions { @param units the units for the quota type *// Whether to include the list of overridden values for every publicquota Key(QuotaType type, QuotaUnits units); type in the result. // public QuotaType type(); // Default: false. publicDescribeQuotasOptions QuotaUnits units(setOmitOverriddenValues(boolean omitOverriddenValues); } } public class DescribeEffectiveQuotasResult { /** * Information about a specific quota configuration entry. */ public class Entry { /** * @param source the entity source for the value * @param value the non-null value */ public Entry(Map<String,QuotaEntity String> source, Double value); public Map<String, String>QuotaEntity source(); public Double value(); } /** * Information about the value for a quota type. */ public class Value { /** * @param entry the quota entry * @param overriddenEntries all values that are overridden due to being lower in * specificity, or null if not requested */ public Value(Entry entry, List<Entry> overriddenEntries); public Entry entry(); public List<Entry> overriddenEntries(); } /** * Maps a quota type to its configuration. */ public Map<QuotaEntity, KafkaFuture<Map<KeyKafkaFuture<Map<QuotaKey, Value>>Value>>> config(); } public interface Admin extends AutoCloseable { /** * Describes the effective quotas for the provided entities. * * @param entities the entities to describe the effective quotas for * @param options the options to use * @return the effective quotas for the entities */ DescribeEffectiveQuotasResult describeEffectiveQuotas(Collection<Map<String, String>>Collection<QuotaEntity> entities, DescribeEffectiveQuotasOptions options); } |
...
Code Block |
---|
public class AlterQuotasEntry { public class Op { /** * @param type the quota type to alter** * @param unitskey the unitsquota type forand theunits quotato typealter * @param value if set then the existing value is updated, * otherwise if null, the existing value is cleared */ public Op(QuotaType type, QuotaUnits unitsQuotaKey key, Double value); public QuotaTypeQuotaKey typekey(); public QuotaUnits units(); public Double value(); } /** * @param entity the entity whose config will be modified * @param ops the alteration to perform - if value is set, then the existing value is updated, * otherwise if null, the existing value is cleared */ public AlterQuotasEntry(Map<String, String>QuotaEntity entity, Collection<Op> ops); public Map<String, String>QuotaEntity entity(); public Collection<Ops> ops(); } public class AlterQuotasOptions { // Default. } public class AlterQuotasResult { /** * @return map of a quota entity update to its future */ public Map<Map<String, String>Map<QuotaEntity, KafkaFuture<Void>> futures(); } public interface Admin extends AutoCloseable { /** * Alters the quotas as specified for the entries. * * @param alterations the alterations to perform * @return the result of the alterations */ AlterQuotasResult alterQuotas(Collection<AlterQuotasEntry> entries, AlterQuotasOptions options); } |
...