Modifying Kafka Access Modes

Updated on 2025-05-21 GMT+08:00

Function

This API is used to modify private or public access for Kafka.

Calling Method

For details, see Calling APIs.

URI

POST /v2/{project_id}/{engine}/instances/{instance_id}/plain-ssl-switch

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details, see Obtaining a Project ID.

engine

Yes

String

Message engine.

instance_id

Yes

String

Instance ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

protocol

No

String

Access modes to be enabled or disabled.

enable

No

Boolean

  • true: Enable

  • false: Disable

user_name

No

String

Username is required when SASL is enabled for the first time. After an instance is created, disabling SASL does not delete the created user. Enabling SASL again does not require the username and an entered username will be invalid.

pass_word

No

String

Password is required when SASL is enabled for the first time.

sasl_enabled_mechanisms

No

Array of strings

Authentication mechanism used after SASL is enabled. Validated only when SASL is enabled for the first time. Reuses are invalid.

  • PLAIN: simple username and password verification.

  • SCRAM-SHA-512: user credential verification, which is more secure than PLAIN.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

job_id

String

Background task ID.

protocol

String

Enabling or disabling the Kafka access mode.

enable

Boolean

Enablement or disablement.

Example Requests

Requiring the username and password when SASL_SSL is enabled for the first time

POST https://{endpoint}/v2/{project_id}/{engine}/instances/{instance_id}/plain-ssl-switch

{
  "protocol" : "private_sasl_ssl_enable",
  "enable" : true,
  "user_name" : "root",
  "pass_word" : "password",
  "sasl_enabled_mechanisms" : [ "SCRAM-SHA-512", "PLAIN" ]
}

Example Responses

Status code: 200

Successful

{
  "job_id" : "ff8080828bdc0f64018bdcadfd8f00d7",
  "protocol" : "private_plain_enable",
  "enable" : true
}

Status Codes

Status Code

Description

200

Successful

Error Codes

See Error Codes.

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback