Skip to content

DeleteAclFilterResponses

reference
1 min readUpdated

Kind: Interface

Source: packages/microservices/external/kafka.interface.ts

Part of: Microservices

DeleteAclFilterResponses represents the result of deleting Kafka ACL entries that match a requested filter. It provides the operation status through errorCode and errorMessage, and returns the ACL records that matched the filter in matchingAcls.

Properties

PropertyType
errorCodenumber
errorMessagestring
matchingAclsMatchingAcl[]

Diagram

mermaid
graph LR
  Request[Kafka ACL delete filter] --> Response[DeleteAclFilterResponses]
  Response --> ErrorCode[errorCode: number]
  Response --> ErrorMessage[errorMessage: string]
  Response --> Matches[matchingAcls: MatchingAcl[]]
  Matches --> Acl1[Matching ACL]
  Matches --> AclN[Matching ACL]

Usage

ts
import type { DeleteAclFilterResponses } from './kafka.interface';

function handleDeleteAclResponse(response: DeleteAclFilterResponses): void {
  if (response.errorCode !== 0) {
    throw new Error(
      `Unable to delete matching ACLs: ${response.errorMessage}`,
    );
  }

  console.log(`Deleted ${response.matchingAcls.length} matching ACL(s).`);

  for (const acl of response.matchingAcls) {
    console.log('Deleted ACL:', acl);
  }
}

// Example response returned by a Kafka ACL deletion operation
const response: DeleteAclFilterResponses = {
  errorCode: 0,
  errorMessage: '',
  matchingAcls: [],
};

handleDeleteAclResponse(response);

AI Coding Instructions

  • Treat errorCode === 0 as the successful operation state; handle non-zero values before consuming matchingAcls.
  • Preserve errorMessage when surfacing Kafka ACL deletion failures to logs, callers, or exceptions.
  • Use matchingAcls to identify the ACLs affected by the filter, rather than assuming every requested ACL was deleted.
  • Keep this response type aligned with the Kafka client/admin API response mapping and the MatchingAcl interface definition.

Was this page helpful?

Download as PDF
DeleteAclFilterResponses — NestJS head-to-head