# DescribeAclResponse

**Kind:** Interface

**Source:** [`packages/microservices/external/kafka.interface.ts`](https://github.com/nestjs/nest/blob/master/packages/microservices/external/kafka.interface.ts#L462)

**Part of:** [Microservices](subsystem-packages-microservices)

`DescribeAclResponse` represents the response payload returned from a Kafka ACL describe operation. It captures request throttling and error details alongside the ACL resources that matched the query.

## Properties

| Property | Type |
|---|---|
| `throttleTime` | `number` |
| `errorCode` | `number` |
| `errorMessage` | `string` |
| `resources` | `DescribeAclResource[]` |

## Diagram

```mermaid
graph LR
  A[Kafka Describe ACL Request] --> B[DescribeAclResponse]
  B --> C[throttleTime: number]
  B --> D[errorCode: number]
  B --> E[errorMessage: string]
  B --> F[resources: DescribeAclResource[]]
  F --> G[Matched ACL resources and entries]
```

## Usage

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

function handleDescribeAclResponse(response: DescribeAclResponse): void {
  if (response.errorCode !== 0) {
    throw new Error(
      `Kafka ACL lookup failed (${response.errorCode}): ${response.errorMessage}`,
    );
  }

  console.log(`Request throttled for ${response.throttleTime}ms`);

  for (const resource of response.resources) {
    console.log('ACL resource:', resource);
  }
}

// Example response received from a Kafka client or protocol handler.
const response: DescribeAclResponse = {
  throttleTime: 0,
  errorCode: 0,
  errorMessage: '',
  resources: [],
};

handleDescribeAclResponse(response);
```

## AI Coding Instructions

- Check `errorCode` before consuming `resources`; a non-zero code indicates the broker could not complete the request.
- Preserve `throttleTime` from the Kafka response so callers can observe or react to broker throttling.
- Treat `resources` as the authoritative list of ACL resources returned by the broker, including an empty array for no matches.
- Keep this interface aligned with the Kafka protocol response shape and the related `DescribeAclResource` definition.

## How it works

`DescribeAclResponse` is an exported TypeScript interface representing the declared result type of `Admin.describeAcls(options)`, which returns `Promise<DescribeAclResponse>`. The method accepts an `AclFilter`; this interface itself declares no runtime logic, validation, thrown errors, or side effects. [packages/microservices/external/kafka.interface.ts:462-467](packages/microservices/external/kafka.interface.ts#L462-L467) [packages/microservices/external/kafka.interface.ts:502-561](packages/microservices/external/kafka.interface.ts#L502-L561)

It has these required fields:

- `throttleTime: number` [packages/microservices/external/kafka.interface.ts:462-464](packages/microservices/external/kafka.interface.ts#L462-L464)
- `errorCode: number` [packages/microservices/external/kafka.interface.ts:462-465](packages/microservices/external/kafka.interface.ts#L462-L465)
- `resources: DescribeAclResource[]` [packages/microservices/external/kafka.interface.ts:462-467](packages/microservices/external/kafka.interface.ts#L462-L467)

It also has an optional `errorMessage?: string`, so an instance may omit that field. [packages/microservices/external/kafka.interface.ts:462-466](packages/microservices/external/kafka.interface.ts#L462-L466)

Each `resources` element is a `DescribeAclResource`: an ACL resource identifier plus an `acls` array. Its inherited resource fields are:

- `resourceType: AclResourceTypes`
- `resourceName: string`
- `resourcePatternType: ResourcePatternTypes`

and it adds `acls: Acl[]`. [packages/microservices/external/kafka.interface.ts:450-460](packages/microservices/external/kafka.interface.ts#L450-L460)

Each ACL in that array has a string `principal`, string `host`, `operation: AclOperationTypes`, and `permissionType: AclPermissionTypes`. [packages/microservices/external/kafka.interface.ts:443-448](packages/microservices/external/kafka.interface.ts#L443-L448) The declared enum domains include resource types such as `TOPIC`, `GROUP`, and `CLUSTER`; operation types such as `READ`, `WRITE`, and `DESCRIBE`; permission types `DENY` and `ALLOW`; and resource pattern types including `LITERAL` and `PREFIXED`. [packages/microservices/external/kafka.interface.ts:285-293](packages/microservices/external/kafka.interface.ts#L285-L293) [packages/microservices/external/kafka.interface.ts:312-341](packages/microservices/external/kafka.interface.ts#L312-L341)
