Search in sources :

Example 1 with OpData

use of org.apache.kafka.common.message.AlterClientQuotasRequestData.OpData in project kafka by apache.

the class AlterClientQuotasRequest method entries.

public List<ClientQuotaAlteration> entries() {
    List<ClientQuotaAlteration> entries = new ArrayList<>(data.entries().size());
    for (EntryData entryData : data.entries()) {
        Map<String, String> entity = new HashMap<>(entryData.entity().size());
        for (EntityData entityData : entryData.entity()) {
            entity.put(entityData.entityType(), entityData.entityName());
        }
        List<ClientQuotaAlteration.Op> ops = new ArrayList<>(entryData.ops().size());
        for (OpData opData : entryData.ops()) {
            Double value = opData.remove() ? null : opData.value();
            ops.add(new ClientQuotaAlteration.Op(opData.key(), value));
        }
        entries.add(new ClientQuotaAlteration(new ClientQuotaEntity(entity), ops));
    }
    return entries;
}
Also used : ClientQuotaAlteration(org.apache.kafka.common.quota.ClientQuotaAlteration) EntryData(org.apache.kafka.common.message.AlterClientQuotasRequestData.EntryData) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) EntityData(org.apache.kafka.common.message.AlterClientQuotasRequestData.EntityData) OpData(org.apache.kafka.common.message.AlterClientQuotasRequestData.OpData) ClientQuotaEntity(org.apache.kafka.common.quota.ClientQuotaEntity)

Aggregations

ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 EntityData (org.apache.kafka.common.message.AlterClientQuotasRequestData.EntityData)1 EntryData (org.apache.kafka.common.message.AlterClientQuotasRequestData.EntryData)1 OpData (org.apache.kafka.common.message.AlterClientQuotasRequestData.OpData)1 ClientQuotaAlteration (org.apache.kafka.common.quota.ClientQuotaAlteration)1 ClientQuotaEntity (org.apache.kafka.common.quota.ClientQuotaEntity)1