use of org.apache.kafka.common.message.AlterClientQuotasRequestData.EntryData in project kafka by apache.
the class AlterClientQuotasRequest method getErrorResponse.
@Override
public AlterClientQuotasResponse getErrorResponse(int throttleTimeMs, Throwable e) {
Errors error = Errors.forException(e);
List<AlterClientQuotasResponseData.EntryData> responseEntries = new ArrayList<>();
for (EntryData entryData : data.entries()) {
List<AlterClientQuotasResponseData.EntityData> responseEntities = new ArrayList<>();
for (EntityData entityData : entryData.entity()) {
responseEntities.add(new AlterClientQuotasResponseData.EntityData().setEntityType(entityData.entityType()).setEntityName(entityData.entityName()));
}
responseEntries.add(new AlterClientQuotasResponseData.EntryData().setEntity(responseEntities).setErrorCode(error.code()).setErrorMessage(error.message()));
}
AlterClientQuotasResponseData responseData = new AlterClientQuotasResponseData().setThrottleTimeMs(throttleTimeMs).setEntries(responseEntries);
return new AlterClientQuotasResponse(responseData);
}
use of org.apache.kafka.common.message.AlterClientQuotasRequestData.EntryData 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;
}
Aggregations