use of org.apache.kafka.common.message.AlterClientQuotasResponseData 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.AlterClientQuotasResponseData in project kafka by apache.
the class AlterClientQuotasResponse method fromQuotaEntities.
public static AlterClientQuotasResponse fromQuotaEntities(Map<ClientQuotaEntity, ApiError> result, int throttleTimeMs) {
List<EntryData> entries = new ArrayList<>(result.size());
for (Map.Entry<ClientQuotaEntity, ApiError> entry : result.entrySet()) {
ApiError e = entry.getValue();
entries.add(new EntryData().setErrorCode(e.error().code()).setErrorMessage(e.message()).setEntity(toEntityData(entry.getKey())));
}
return new AlterClientQuotasResponse(new AlterClientQuotasResponseData().setThrottleTimeMs(throttleTimeMs).setEntries(entries));
}
Aggregations