use of org.apache.kafka.common.message.DescribeClientQuotasRequestData.ComponentData in project kafka by apache.
the class DescribeClientQuotasRequest method filter.
public ClientQuotaFilter filter() {
List<ClientQuotaFilterComponent> components = new ArrayList<>(data.components().size());
for (ComponentData componentData : data.components()) {
ClientQuotaFilterComponent component;
switch(componentData.matchType()) {
case MATCH_TYPE_EXACT:
component = ClientQuotaFilterComponent.ofEntity(componentData.entityType(), componentData.match());
break;
case MATCH_TYPE_DEFAULT:
component = ClientQuotaFilterComponent.ofDefaultEntity(componentData.entityType());
break;
case MATCH_TYPE_SPECIFIED:
component = ClientQuotaFilterComponent.ofEntityType(componentData.entityType());
break;
default:
throw new IllegalArgumentException("Unexpected match type: " + componentData.matchType());
}
components.add(component);
}
if (data.strict()) {
return ClientQuotaFilter.containsOnly(components);
} else {
return ClientQuotaFilter.contains(components);
}
}
Aggregations