Introduction

IBM Event Streams for IBM Cloud is a high-throughput message bus built with Apache Kafka. It is optimized for event ingestion into IBM Cloud and event stream distribution between your services and applications.

Event Streams provides a REST API to help connect your existing systems to your Event Streams Kafka cluster. Using the API, you can integrate Event Streams with any system that supports RESTful APIs.

SDKs

Event Streams is based on the open source Apache Kafka, and as such, all SDKs (client libraries) are provided for the open source community, covering the core runtimes listed. For the most up-to-date information about these libraries, refer to the project homepages.

For more information on what is supported, see support summary for all recommended clients.

SDK language support

This Admin REST API supports the four core languages and the SDKs are available as follows.

Endpoint URLs

Administration API endpoint is the kafka_admin_url property in the service key for the service instance. This command can be used to retrieve the kafka_admin_url property property.

$ibmcloud resource service-key "${service_instance_key_name}" --output json > jq -r '.[]|.credentials.kafka_admin_url'

In addition, the Content-type header must be set to application/json.

Error handling

This API uses standard HTTP response codes to indicate whether a method completed successfully. A 200 response code indicates success. A 400 response code indicates a failure, and a 500 response code indicates an internal system error.

HTTP error code Description Recovery
200 OK Message successfully sent to Event Streams.
202 Request accepted Kafka accepted the request and processes the request.
400 Bad request Not a valid request.
401 Unauthorized The authentication header is not set or provided information is not valid.
403 Not authorized to perform the operation The API key used is missing a certain role. For more details on what role can perform what operation, see Managing access to your Event Streams resources.
404 Not found Unable to find the topic with the topic name you specified.
408 Request timeout The request timed out producing to Event Streams.
422 Semantically invalid request You have a malformed request.
500 Internal server error The request failed due to an internal server error.
503 Service unavailable The request failed due to Event Streams brokers being unavailable.

Error responses carry a JSON body, such as the following:

{"error_code":50301,"message":"Unknown Kafka Error", "incident_id": "17afe715-0ff5-4c49-9acc-a4204244a331"}

Error codes have the format HHHKK, where HHH is the HTTP status code and KK is the Kafka protocol error.

For end-to-end debugging purposes, the transaction ID of every request is returned in the HTTP header X-Global-Transaction-Id. If the header is set on the request, it is honored. If not, it is generated. In the event of a non-200 error code, the transaction ID is also returned in the JSON error response as incident_id.

Authentication

Use one of the following methods to authenticate:

  • To authenticate using Basic Auth:
    Use the user and api_key properties of the above objects as the username and password. Place these values into the Authorization header of the HTTP request in the form Basic <base64 encoding of username and password joined by a single colon (:)>.

  • To authenticate using a bearer token:
    To obtain your token using the IBM Cloud CLI, first log in to IBM Cloud, then run the following command:

      ibmcloud iam oauth-tokens
    

    Place this token in the Authorization header of the HTTP request in the form Bearer<token>. Both API key and JWT tokens are supported.

  • To authenticate directly using the api_key:
    Place the key directly as the value of the X-Auth-Token HTTP header.

The following list shows the headers required to authenticate with CURL:

-H 'Accept: application/json'
-H 'Content-Type: application/json'
-H 'Authorization: Bearer ${TOKEN}' (use with bearer token)
-H 'Authorization: X-Auth-Token ${API_KEY} (use with API Key)

The following shows an example of how to authenticate with Go:

    // Create Authenticator
    var authenticator core.Authenticator

    if apiKey != "" {
        var err error
        // Create an Basic IAM authenticator.
        authenticator, err = core.NewBasicAuthenticator("token", apiKey)
        if err != nil {
            fmt.Printf("failed to create new basic authenticator: %s\n", err.Error())
            os.Exit(1)
        }
    } else {
        var err error
        // Create an IAM Bearer Token authenticator.
        authenticator, err = core.NewBearerTokenAuthenticator(bearerToken)
        if err != nil {
            fmt.Printf("failed to create new bearer token authenticator: %s\n", err.Error())
            os.Exit(1)
        }
    }
    // End Authenticator

The following example shows how to authenticate with Python:

# Create Authenticator
if not KAFKA_ADMIN_URL:
    print("Please set env KAFKA_ADMIN_URL")
    exit(1)

if not API_KEY and not BEARER_TOKEN:
    print("Please set either an API_KEY or a BEARER_TOKEN")
    exit(1)

if API_KEY and BEARER_TOKEN:
    print("Please set either an API_KEY or a BEARER_TOKEN not both")
    exit(1)

if API_KEY:
    # Create an Basic IAM authenticator.
    authenticator = BasicAuthenticator('token', API_KEY)
else :
    # Create an IAM Bearer Token authenticator.
    authenticator = BasicAuthenticator('token', BEARER_TOKEN)

service = AdminrestV1(
    authenticator = authenticator
    )
# End Authenticator

The following example shows how to authenticate with Java:

        // Create Authenticator
        Authenticator authenticator;

        if (apiKey != null && !apiKey.isEmpty()) {
            // Create an Basic IAM authenticator.
            authenticator = new BasicAuthenticator("token", apiKey);
        } else {
            // Create an IAM Bearer Token authenticator.
            authenticator = new BearerTokenAuthenticator(bearerToken);
        }

        // Create Service - Construct the service client.
        Adminrest service = new Adminrest(serviceName, authenticator);
        // End Authenticator

The following example shows how to authenticate with Node:

// Create Authenticator
if (KAFKA_ADMIN_URL === undefined || !KAFKA_ADMIN_URL) {
  console.log('Please set env KAFKA_ADMIN_URL');
  throw new Error('error KAFKA_ADMIN_URL not set');
}

if ((API_KEY === undefined || !API_KEY) && (BEARER_TOKEN === undefined || !BEARER_TOKEN)) {
  console.log('Please set either an API_KEY or a BEARER_TOKEN');
  throw new Error('error: API_KEY or BEARER_TOKEN not set');
}

if (API_KEY && BEARER_TOKEN) {
  console.log('Please set either an API_KEY or a BEARER_TOKEN not both');
  throw new Error('error: API_KEY and BEARER_TOKEN can not both be set');
}

if (API_KEY) {
  // Create an Basic IAM authenticator.
  authenticator = new BasicAuthenticator({
    username: 'token',
    password: API_KEY,
  });
} else {
  // Create an IAM Bearer Token authenticator.
  authenticator = new BearerTokenAuthenticator({
    bearerToken: BEARER_TOKEN,
  });
}
// End Authenticator

Code setup

The following sections show how to set up the code for each language.

No code setup is required for CURL.

N/A

The following example shows how to set up with Go:

// Code Setup
import (
    "fmt"
    "net/http"
    "os"

    "github.com/IBM/eventstreams-go-sdk/pkg/adminrestv1"
    "github.com/IBM/go-sdk-core/v4/core"
)

// End Code Setup

The following shows an example of how to set up with Python:

# Code Setup
from typing import Set
from ibm_cloud_sdk_core.authenticators import BasicAuthenticator
from eventstreams_sdk.adminrest_v1 import *
import os
from http import HTTPStatus

SERVICE_NAME = 'adminrest_v1'
KAFKA_ADMIN_URL = os.getenv('KAFKA_ADMIN_URL')
BEARER_TOKEN= os.getenv('BEARER_TOKEN')
API_KEY= os.getenv('API_KEY')

# End Code Setup

The following shows an example of how to set up with Java:

// Code Setup
package com.ibm.cloud.adminrest.v1;

import java.util.Arrays;
import java.util.List;
import com.ibm.cloud.eventstreams_sdk.adminrest.v1.Adminrest;
import com.ibm.cloud.eventstreams_sdk.adminrest.v1.model.ListTopicsOptions;
import com.ibm.cloud.eventstreams_sdk.adminrest.v1.model.TopicDetail;
import com.ibm.cloud.eventstreams_sdk.adminrest.v1.model.CreateTopicOptions;
import com.ibm.cloud.eventstreams_sdk.adminrest.v1.model.DeleteTopicOptions;
import com.ibm.cloud.eventstreams_sdk.adminrest.v1.model.UpdateTopicOptions;
import com.ibm.cloud.eventstreams_sdk.adminrest.v1.model.ReplicaAssignment;
import com.ibm.cloud.eventstreams_sdk.adminrest.v1.model.GetMirroringActiveTopicsOptions;
import com.ibm.cloud.eventstreams_sdk.adminrest.v1.model.MirroringActiveTopics;
import com.ibm.cloud.eventstreams_sdk.adminrest.v1.model.ReplaceMirroringTopicSelectionOptions;
import com.ibm.cloud.eventstreams_sdk.adminrest.v1.model.MirroringTopicSelection;
import com.ibm.cloud.eventstreams_sdk.adminrest.v1.model.GetMirroringTopicSelectionOptions;
import com.ibm.cloud.sdk.core.security.Authenticator;
import com.ibm.cloud.sdk.core.security.BasicAuthenticator;
import com.ibm.cloud.sdk.core.security.BearerTokenAuthenticator;
import com.ibm.cloud.sdk.core.http.Response;
import com.ibm.cloud.sdk.core.http.HttpStatus;

public class AdminrestExample {


    private AdminrestExample() {
    }
// End Code Setup

The following example shows how to set up with Node:

// Code Setup
const HTTP = require('http');
const util = require('util');
const KAFKA_ADMIN_URL = process.env.KAFKA_ADMIN_URL;
const API_KEY = process.env.API_KEY;
const BEARER_TOKEN = process.env.BEARER_TOKEN;
const NewAdminrestV1 = require('../dist/adminrest/v1');
const { BasicAuthenticator } = require('../dist/auth');
const { BearerTokenAuthenticator } = require('../dist/auth');
const { NoAuthAuthenticator } = require('../dist/auth');
const topicName = 'test-topic';
let authenticator = new NoAuthAuthenticator({});
/* eslint-disable no-console */

// Code Setup End

Create service

The following sections show how to create a service for each language.

No service setup is required for CURL.

N/A

The following example shows how to create a service with Go:

    // Create Service
    serviceAPI, serviceErr := adminrestv1.NewAdminrestV1(&adminrestv1.AdminrestV1Options{
        URL:           URL,
        Authenticator: authenticator,
    })
    // End Create Service

The following example shows how to create a service with Python:

# Create Service
base_url = KAFKA_ADMIN_URL
service.set_service_url(base_url)
# End Create Service

The following example shows how to create a service with Java:

        // Create Service - Construct the service client.
        Adminrest service = new Adminrest(serviceName, authenticator);
        // End Authenticator

The following example shows how to create a service with Node:

// Create Service
// Construct the service client.
const adminREST = new NewAdminrestV1({
  authenticator,
  serviceUrl: KAFKA_ADMIN_URL,
});
// End Create Service

Methods

Get a list of topics.

Returns a list containing information about all of the Kafka topics that are defined for an instance of the Event Streams service. If there are currently no topics defined then an empty list is returned.

Returns a list containing information about all of the Kafka topics that are defined for an instance of the Event Streams service. If there are currently no topics defined then an empty list is returned.

Returns a list containing information about all of the Kafka topics that are defined for an instance of the Event Streams service. If there are currently no topics defined then an empty list is returned.

Returns a list containing information about all of the Kafka topics that are defined for an instance of the Event Streams service. If there are currently no topics defined then an empty list is returned.

Returns a list containing information about all of the Kafka topics that are defined for an instance of the Event Streams service. If there are currently no topics defined then an empty list is returned.

GET /admin/topics
ServiceCall<List<TopicDetail>> listTopics(ListTopicsOptions listTopicsOptions)
list_topics(self,
        *,
        topic_filter: str = None,
        per_page: int = None,
        page: int = None,
        **kwargs
    ) -> DetailedResponse
list_topics(self,
        *,
        topic_filter: str = None,
        per_page: int = None,
        page: int = None,
        **kwargs
    ) -> DetailedResponse
(adminrest *AdminrestV1) ListTopics(listTopicsOptions *ListTopicsOptions) (result []TopicDetail, response *core.DetailedResponse, err error)
(adminrest *AdminrestV1) ListTopicsWithContext(ctx context.Context, listTopicsOptions *ListTopicsOptions) (result []TopicDetail, response *core.DetailedResponse, err error)

Authentication

This method uses the following security schemes for authentication.

Request

Use the ListTopicsOptions.Builder to create a ListTopicsOptions object that contains the parameter values for the listTopics method.

Instantiate the ListTopicsOptions struct and set the fields to provide parameter values for the ListTopics method.

Query Parameters

  • A filter to be applied to the topic names. A simple filter can be specified as a string with asterisk (*) wildcards representing 0 or more characters, e.g. topic-name* will filter all topic names that begin with the string topic-name followed by any character sequence. A more complex filter pattern can be used by surrounding a regular expression in forward slash (/) delimiters, e.g. /topic-name.* /.

  • The number of topic names to be returns.

  • The page number to be returned. The number 1 represents the first page. The default value is 1.

The listTopics options.

parameters

  • A filter to be applied to the topic names. A simple filter can be specified as a string with asterisk (*) wildcards representing 0 or more characters, e.g. topic-name* will filter all topic names that begin with the string topic-name followed by any character sequence. A more complex filter pattern can be used by surrounding a regular expression in forward slash (/) delimiters, e.g. /topic-name.* /.

  • The number of topic names to be returns.

  • The page number to be returned. The number 1 represents the first page. The default value is 1.

parameters

  • A filter to be applied to the topic names. A simple filter can be specified as a string with asterisk (*) wildcards representing 0 or more characters, e.g. topic-name* will filter all topic names that begin with the string topic-name followed by any character sequence. A more complex filter pattern can be used by surrounding a regular expression in forward slash (/) delimiters, e.g. /topic-name.* /.

  • The number of topic names to be returns.

  • The page number to be returned. The number 1 represents the first page. The default value is 1.

WithContext method only

The ListTopics options.

  • curl -i -X GET -H 'Accept: application/json' -H 'Authorization: Bearer ${TOKEN}' ${ADMIN_URL}/admin/topics
    
  • func listTopics(serviceAPI *adminrestv1.AdminrestV1) error {
    	// Construct an instance of the ListTopicsOptions model
    	listTopicsOptionsModel := new(adminrestv1.ListTopicsOptions)
    
    	// Call ListTopics.
    	result, response, operationErr := serviceAPI.ListTopics(listTopicsOptionsModel)
    	if operationErr != nil {
    		return fmt.Errorf("Error Listing Topics" + operationErr.Error())
    	}
    
    	// Check the result.
    	if response.StatusCode != http.StatusOK {
    		return fmt.Errorf("Error Listing Topics: status %d\n", response.StatusCode)
    	}
    
    	// Loop and print topics.
    	for _, topicDetail := range result {
    		fmt.Printf("\tname: %s\n", *topicDetail.Name)
    	}
    	return nil
    } 
    
    
  •     private static void listTopics(Adminrest service) {
            System.out.println("List Topics");
    
            // Construct an instance of the ListTopicsOptions.
            ListTopicsOptions listTopicsOptions = new ListTopicsOptions.Builder()
                .build();
            // .topicFilter defaults to an empty string to see all topics.
            // or you can specify a topic name.
            //.topicFilter("<You Topic Name>");
    
            // Invoke operation with valid options.
            Response<List<TopicDetail>> response = service.listTopics(listTopicsOptions).execute();
    
            // Print the results.
            if (response.getStatusCode() == HttpStatus.OK) {
                for (TopicDetail topicDetail : response.getResult()) {
                    System.out.println("\t" + topicDetail.getName());
                }
            } else {
                System.out.println("Error listing topics");
            }
        } 
    
    
  • function listTopics(adminREST) {
      console.log('List Topics');
    
      // Construct the params object for operation listTopics.
      const params = {
        // topicFilter defaults to an empty string to see all topics.
        // or you can specify a topic name.
        // topicFilter: '<You Topic Name>',
      };
    
      // Service operations can now be invoked using the 'adminREST' variable.
      // Call listTopics on the service.
      const listTopicsResult = adminREST.listTopics(params);
    
      // Look at the results of the promise.
      return listTopicsResult.then(
        result => {
          if (HTTP.STATUS_CODES[result.status] == 'OK') {
            for (const val of result.result) {
              console.log('\tname: ' + val.name);
            }
          }
        },
        err => {
          console.log('Error listing topics ' + err);
        }
      );
    } 
    
    
  • def list_topics(service):
        # Set up parameter values
        topic_filter = ''
        # Invoke list method.
        try:
            response = service.list_topics(
                topic_filter=topic_filter,
                )
    
            if response.status_code == HTTPStatus.OK:
                if not response.result :
                    print("\tnothing to list")
                    return
                for topic in response.result: 
                     print("\t" + topic["name"])
        except:
            print("\tError Listing Topics")
        # func.end
    
    

Response

Response type: List<TopicDetail>

Response type: List[TopicDetail]

Response type: List[TopicDetail]

Response type: []TopicDetail

A list of 'topic_detail' is returned.

Status Code

  • Success. A list of topic information objects is returned in the response body.

  • Authentication information was missing or bad.

  • Service was unavailable.

No Sample Response

This method does not specify any sample responses.

Create a new topic.

Create a new topic.

Create a new topic.

Create a new topic.

Create a new topic.

Create a new topic.

POST /admin/topics
ServiceCall<Void> createTopic(CreateTopicOptions createTopicOptions)
create_topic(self,
        *,
        name: str = None,
        partitions: int = None,
        partition_count: int = None,
        configs: List['ConfigCreate'] = None,
        **kwargs
    ) -> DetailedResponse
create_topic(self,
        *,
        name: str = None,
        partitions: int = None,
        partition_count: int = None,
        configs: List['ConfigCreate'] = None,
        **kwargs
    ) -> DetailedResponse
(adminrest *AdminrestV1) CreateTopic(createTopicOptions *CreateTopicOptions) (response *core.DetailedResponse, err error)
(adminrest *AdminrestV1) CreateTopicWithContext(ctx context.Context, createTopicOptions *CreateTopicOptions) (response *core.DetailedResponse, err error)

Authentication

This method uses the following security schemes for authentication.

Request

Use the CreateTopicOptions.Builder to create a CreateTopicOptions object that contains the parameter values for the createTopic method.

Instantiate the CreateTopicOptions struct and set the fields to provide parameter values for the CreateTopic method.

The new topic to be created.

The createTopic options.

parameters

  • The name of topic to be created.

  • The number of partitions.

  • The number of partitions, this field takes precedence over 'partitions'. Default value is 1 if not specified.

    Possible values: 1 ≤ value ≤ 1000

  • The config properties to be set for the new topic.

parameters

  • The name of topic to be created.

  • The number of partitions.

  • The number of partitions, this field takes precedence over 'partitions'. Default value is 1 if not specified.

    Possible values: 1 ≤ value ≤ 1000

  • The config properties to be set for the new topic.

WithContext method only

The CreateTopic options.

  • curl -i -X POST -H 'Accept: application/json' -H 'Content-Type: application/json' -H 'Authorization: Bearer ${TOKEN}' --data '
    { 
        "name": "newtopic", 
        "partitions": 1
    }' ${ADMIN_URL}/admin/topics
    
  • func createTopic(serviceAPI *adminrestv1.AdminrestV1) error {
    	// Construct an instance of the createTopicOptionsModel.
    	createTopicOptionsModel := new(adminrestv1.CreateTopicOptions)
    	createTopicOptionsModel.Name = core.StringPtr("test-topic")
    	createTopicOptionsModel.PartitionCount = core.Int64Ptr(int64(1))
    
    	// Create the Topic.
    	response, operationErr := serviceAPI.CreateTopic(createTopicOptionsModel)
    	if operationErr != nil {
    		return fmt.Errorf("Error Creating Topics: %s\n", operationErr.Error())
    	}
    
    	// Check the result.
    	if response.StatusCode != http.StatusAccepted {
    		return fmt.Errorf("Error Creating Topic: status %d\n", response.StatusCode)
    	}
    
    	fmt.Printf("\tname: %s created\n", *createTopicOptionsModel.Name)
    
    	return nil
    } 
    
    
  •     private static void createTopic(Adminrest service, String topicName) {
            System.out.println("Create Topic");
    
            // Construct an instance of the CreateTopicOptions.
            CreateTopicOptions createTopicOptions = new CreateTopicOptions.Builder()
                .name(topicName)
                .partitions(3) // Create with three partitions.
                .build();
    
            // Invoke operation with valid options.
            Response<Void> response = service.createTopic(createTopicOptions).execute();
    
            // Print the results.
            if (response.getStatusCode() == HttpStatus.ACCEPTED) {
                System.out.println("\ttopic created: " + topicName);
            } else {
                System.out.println("Error creating topic: " + topicName);
            }
        } 
    
    
  • function createTopic(adminREST, topicName) {
      console.log('Create Topic');
      // Construct the params object for operation createTopic
      const name = topicName;
      const partitions = 3;
      const params = {
        name: name,
        partitions: partitions,
      };
    
      // Call the create topic function on the service.
      const createTopicResult = adminREST.createTopic(params);
    
      // Look at the results of the promise.
      return createTopicResult.then(
        result => {
          if (HTTP.STATUS_CODES[result.status] == 'Accepted') {
            console.log('\tname: ' + topicName);
          }
        },
        err => {
          console.log('\tError creating topics ' + err);
        }
      );
    } 
    
    
  • def create_topic(service,topic_name):
        # Set up parameter values
        partition_count = 1
        configs = []
    
        # Invoke create method.
        try:
            response = service.create_topic(
                name=topic_name,
                partition_count=partition_count,
                configs=configs,
            )
            if response.status_code == HTTPStatus.ACCEPTED :  
                print("\ttopic created: " + topic_name)
        except:
            print("\tError Creating Topic: " + topic_name)
        # func.End
    
    

Response

Expected empty response could be {}.

Status Code

  • Topic creation request accepted. Topic creation occurs asynchronously, and therefore invoking the list topics REST endpoint may not immediately show newly created topics.

  • The request body was invalid JSON.

  • Authentication information was missing or bad.

  • Not authorized to perform the operation.

  • The server was not able to process the request body.

  • Service was unavailable.

No Sample Response

This method does not specify any sample responses.

Delete a topic.

Delete a topic.

Delete a topic.

Delete a topic.

Delete a topic.

Delete a topic.

DELETE /admin/topics/{topic_name}
ServiceCall<Void> deleteTopic(DeleteTopicOptions deleteTopicOptions)
delete_topic(self,
        topic_name: str,
        **kwargs
    ) -> DetailedResponse
delete_topic(self,
        topic_name: str,
        **kwargs
    ) -> DetailedResponse
(adminrest *AdminrestV1) DeleteTopic(deleteTopicOptions *DeleteTopicOptions) (response *core.DetailedResponse, err error)
(adminrest *AdminrestV1) DeleteTopicWithContext(ctx context.Context, deleteTopicOptions *DeleteTopicOptions) (response *core.DetailedResponse, err error)

Authentication

This method uses the following security schemes for authentication.

Request

Use the DeleteTopicOptions.Builder to create a DeleteTopicOptions object that contains the parameter values for the deleteTopic method.

Instantiate the DeleteTopicOptions struct and set the fields to provide parameter values for the DeleteTopic method.

Path Parameters

  • The topic name for the topic to be listed.

The deleteTopic options.

parameters

  • The topic name for the topic to be listed.

parameters

  • The topic name for the topic to be listed.

WithContext method only

The DeleteTopic options.

  • curl -i -H 'Content-Type: application/json' -X DELETE -H 'Authorization: Bearer ${TOKEN}' ${ADMIN_URL}/admin/topics/MYTOPIC
    
  • func deleteTopic(serviceAPI *adminrestv1.AdminrestV1) error {
    	// Construct an instance of the DeleteTopicOptions model
    	deleteTopicOptionsModel := new(adminrestv1.DeleteTopicOptions)
    	deleteTopicOptionsModel.TopicName = core.StringPtr("test-topic")
    
    	// Delete Topic
    	response, operationErr := serviceAPI.DeleteTopic(deleteTopicOptionsModel)
    	if operationErr != nil {
    		return fmt.Errorf("Error Deleting Topic: %s\n", operationErr.Error())
    	}
    
    	// Check the result.
    	if response.StatusCode != http.StatusAccepted {
    		return fmt.Errorf("Error Deleting Topic: status %d\n", response.StatusCode)
    	}
    
    	fmt.Printf("\tname: %s deleted\n", *deleteTopicOptionsModel.TopicName)
    	return nil
    } 
    
    
  •     private static void deleteTopic(Adminrest service, String topicName) {
            System.out.println("Delete Topic");
    
            // Construct an instance of the CreateTopicOptions.
            DeleteTopicOptions deleteTopicOptions = new DeleteTopicOptions.Builder()
                .topicName(topicName)
                .build();
    
            // Invoke operation with valid options.
            Response<Void> response = service.deleteTopic(deleteTopicOptions).execute();
    
            // Print the results.
            if (response.getStatusCode() == HttpStatus.ACCEPTED) {
                System.out.println("\ttopic deleted: " + topicName);
            } else {
                System.out.println("Error deleting topic: " + topicName);
            }
        } 
    
    
  • function deleteTopic(adminREST, topicName) {
      console.log('Delete Topic');
    
      // Construct the params object for operation deleteTopic
      const params = {
        topicName: topicName,
      };
    
      // Call the delete topic function on the service.
      const deleteTopicResult = adminREST.deleteTopic(params);
    
      // Look at the results of the promise.
      return deleteTopicResult.then(
        result => {
          if (HTTP.STATUS_CODES[result.status] == 'Accepted') {
            console.log('\tname: ' + topicName);
          }
        },
        err => {
          console.log('\tError deleting topic: ' + topicName + 'error: ' + err);
        }
      );
    } 
    
    
  • def delete_topic(service,topic_name):
        # Lets try to delete it.
        try:
            response = service.delete_topic(
                topic_name,
                )
            if response.status_code == HTTPStatus.ACCEPTED: 
                print("\ttopic deleted: "+topic_name)
        except:
            print("\tError Deleting Topic: " + topic_name)
        # func.End
    
    

Response

Expected empty response could be {}.

Status Code

  • The Topic delete request accepted. The Kafka topic deletion process occurs asynchronously. Duplicate deletion requests for a topic which is in the process of being deleted will return this status code. Requests to delete a non-existent topic will also return this status code.

  • Authentication information was missing or bad.

  • Not authorized to perform the operation.

  • The requested resource was not found.

  • Service was unavailable.

No Sample Response

This method does not specify any sample responses.

Get detailed information on a topic.

Get detailed information on a topic.

Get detailed information on a topic.

Get detailed information on a topic.

Get detailed information on a topic.

Get detailed information on a topic.

GET /admin/topics/{topic_name}
ServiceCall<TopicDetail> getTopic(GetTopicOptions getTopicOptions)
get_topic(self,
        topic_name: str,
        **kwargs
    ) -> DetailedResponse
get_topic(self,
        topic_name: str,
        **kwargs
    ) -> DetailedResponse
(adminrest *AdminrestV1) GetTopic(getTopicOptions *GetTopicOptions) (result *TopicDetail, response *core.DetailedResponse, err error)
(adminrest *AdminrestV1) GetTopicWithContext(ctx context.Context, getTopicOptions *GetTopicOptions) (result *TopicDetail, response *core.DetailedResponse, err error)

Authentication

This method uses the following security schemes for authentication.

Request

Use the GetTopicOptions.Builder to create a GetTopicOptions object that contains the parameter values for the getTopic method.

Instantiate the GetTopicOptions struct and set the fields to provide parameter values for the GetTopic method.

Path Parameters

  • The topic name for the topic to be listed.

The getTopic options.

parameters

  • The topic name for the topic to be listed.

parameters

  • The topic name for the topic to be listed.

WithContext method only

The GetTopic options.

  • curl -i -X GET -H 'Content-Type: application/json' -H 'Authorization: Bearer ${TOKEN}' ${ADMIN_URL}/admin/topics/MYTOPIC
    
  • func topicDetails(serviceAPI *adminrestv1.AdminrestV1) error {
    	// Construct an instance of the GetTopicOptions model
    	getTopicOptionsModel := new(adminrestv1.GetTopicOptions)
    	getTopicOptionsModel.TopicName = core.StringPtr("test-topic")
    
    	// Call List Topic Details.
    	result, response, operationErr := serviceAPI.GetTopic(getTopicOptionsModel)
    	if operationErr != nil {
    		return fmt.Errorf("Error Listing Topic Details" + operationErr.Error())
    	}
    
    	// Check the result.
    	if response.StatusCode != http.StatusOK {
    		return fmt.Errorf("Error Listing Topic Details: status %d\n", response.StatusCode)
    	}
    
    	// Print topics details.
    	fmt.Printf("\tname: \t\t\t%s\n", *result.Name)
    
    	// The number of partitions.
    	fmt.Printf("\tno of partitions: \t%d\n", *result.Partitions)
    
    	// The number of replication factor.
    	fmt.Printf("\treplication factor: \t%d\n", *result.ReplicationFactor)
    
    	// // The value of config property 'retention.ms'.
    	fmt.Printf("\tretention (ms): \t%d\n", *result.RetentionMs)
    
    	// // The value of config property 'cleanup.policy'.
    	fmt.Printf("\tcleanup policy: \t%s\n", *result.CleanupPolicy)
    
    	// Configs *TopicConfigs
    	fmt.Printf("\ttopic configs: \t\t%+v\n", *result.Configs)
    
    	// The replia assignment of the topic.
    	// ReplicaAssignments []ReplicaAssignment
    	for _, assignment := range result.ReplicaAssignments {
    		fmt.Printf("\tassignment:  \t\tid:%d,  \tbrokers: %+v\n", assignment.ID, assignment.Brokers)
    	}
    
    	return nil
    
    } 
    
    
  •     private static void topicDetails(Adminrest service, String topicName) {
    
            System.out.println("Topic Details");
    
            // Construct an instance of the ListTopicsOptions.
            ListTopicsOptions listTopicsOptions = new ListTopicsOptions.Builder()
                .topicFilter(topicName)
                .build();
    
            // Invoke operation with valid options.
            Response<List<TopicDetail>> response = service.listTopics(listTopicsOptions).execute();
    
            // Print the results.
            if (response.getStatusCode() == HttpStatus.OK) {
                for (TopicDetail topicDetail : response.getResult()) {
                    System.out.println("\tname:\t" + topicDetail.getName());
                    System.out.println("\tpartitions:\t" + topicDetail.getPartitions());
                    System.out.println("\treplication factor:\t" + topicDetail.getReplicationFactor());
                    System.out.println("\tretention ms:\t" + topicDetail.getRetentionMs());
                    // Print configs.
                    System.out.println("\t\tcleanup policy:\t" + topicDetail.getConfigs().getCleanupPolicy());
                    System.out.println("\t\tmin insync replicas:\t" + topicDetail.getConfigs().getMinInsyncReplicas());
                    System.out.println("\t\tretention bytes:\t" + topicDetail.getConfigs().getRetentionBytes());
                    System.out.println("\t\tretention ms:\t" + topicDetail.getConfigs().getRetentionMs());
                    System.out.println("\t\tsegment bytes:\t" + topicDetail.getConfigs().getSegmentBytes());
                    System.out.println("\t\tsegment index bytes:\t" + topicDetail.getConfigs().getSegmentIndexBytes());
                    System.out.println("\t\tsegment ms:\t" + topicDetail.getConfigs().getSegmentMs());
                    // Print assignments.
                    for (ReplicaAssignment replicaAssignment : topicDetail.getReplicaAssignments()) {
                        System.out.println("\t\treplica id:\t" + replicaAssignment.getId());
                        System.out.println("\t\treplica brokers:\t" + replicaAssignment.getBrokers().getReplicas());
                    }
                }
            } else {
                System.out.println("Error getting topic details: " + topicName);
            }
        } 
    
    
  • function topicDetails(adminREST, topicName) {
      console.log('Topic Details');
    
      // Construct the params object for operation getTopic
      const params = {
        topicName: topicName,
      };
    
      // Call the get topic function on the service.
      const getTopicResult = adminREST.getTopic(params);
    
      // Look at the results of the promise.
      return getTopicResult.then(
        result => {
          if (HTTP.STATUS_CODES[result.status] == 'OK') {
            console.log(util.inspect(result.result, false, null, true));
          }
        },
        err => {
          console.log('\tError getting topic details: ' + topicName + 'error: ' + err);
        }
      );
    } 
    
    
  • def topic_details(service,topic_name):
        # Invoke get method.
        try:
            response = service.get_topic(
                topic_name,
                )
            if response.status_code == HTTPStatus.OK:  
                for key, value in response.result.items(): 
                    print("\t" +key + ":" + str(value) )
        except:
            print("\tError Getting Topic Details: " + topic_name)
        # func.End  
    
    

Response

Status Code

  • Returns a detailed description of a single topic.

  • Authentication information was missing or bad.

  • The requested resource was not found.

  • Service was unavailable.

No Sample Response

This method does not specify any sample responses.

Increase the number of partitions and/or update one or more topic configuration parameters.

Increase the number of partitions and/or update one or more topic configuration parameters.

Increase the number of partitions and/or update one or more topic configuration parameters.

Increase the number of partitions and/or update one or more topic configuration parameters.

Increase the number of partitions and/or update one or more topic configuration parameters.

Increase the number of partitions and/or update one or more topic configuration parameters.

PATCH /admin/topics/{topic_name}
ServiceCall<Void> updateTopic(UpdateTopicOptions updateTopicOptions)
update_topic(self,
        topic_name: str,
        *,
        new_total_partition_count: int = None,
        configs: List['ConfigUpdate'] = None,
        **kwargs
    ) -> DetailedResponse
update_topic(self,
        topic_name: str,
        *,
        new_total_partition_count: int = None,
        configs: List['ConfigUpdate'] = None,
        **kwargs
    ) -> DetailedResponse
(adminrest *AdminrestV1) UpdateTopic(updateTopicOptions *UpdateTopicOptions) (response *core.DetailedResponse, err error)
(adminrest *AdminrestV1) UpdateTopicWithContext(ctx context.Context, updateTopicOptions *UpdateTopicOptions) (response *core.DetailedResponse, err error)

Authentication

This method uses the following security schemes for authentication.

Request

Use the UpdateTopicOptions.Builder to create a UpdateTopicOptions object that contains the parameter values for the updateTopic method.

Instantiate the UpdateTopicOptions struct and set the fields to provide parameter values for the UpdateTopic method.

Path Parameters

  • The topic name for the topic to be listed.

The new partition number or the configurations to be updated for the topic.

The updateTopic options.

parameters

  • The topic name for the topic to be listed.

  • The new partition number to be increased.

  • The config properties to be updated for the topic. Valid config keys are 'cleanup.policy', 'retention.ms', 'retention.bytes', 'segment.bytes', 'segment.ms', 'segment.index.bytes'.

parameters

  • The topic name for the topic to be listed.

  • The new partition number to be increased.

  • The config properties to be updated for the topic. Valid config keys are 'cleanup.policy', 'retention.ms', 'retention.bytes', 'segment.bytes', 'segment.ms', 'segment.index.bytes'.

WithContext method only

The UpdateTopic options.

  • curl -i -X PATCH -H 'Content-Type: application/json' -H 'Authorization: Bearer ${TOKEN}' --data '{"new_total_partition_count": 4,"configs":[{"name":"cleanup.policy","value":"compact"}]}' ${ADMIN_URL}/admin/topics/MYTOPIC
    
  • func updateTopicDetails(serviceAPI *adminrestv1.AdminrestV1) error {
    	// Construct an instance of the UpdateTopicOptions model
    	updateTopicOptionsModel := new(adminrestv1.UpdateTopicOptions)
    	updateTopicOptionsModel.TopicName = core.StringPtr("test-topic")
    	updateTopicOptionsModel.NewTotalPartitionCount = core.Int64Ptr(int64(6))
    
    	// Invoke operation with valid options model.
    	response, operationErr := serviceAPI.UpdateTopic(updateTopicOptionsModel)
    	if operationErr != nil {
    		return fmt.Errorf("Error Updating Topic: %s\n", operationErr.Error())
    	}
    
    	// Check the result.
    	if response.StatusCode != http.StatusAccepted {
    		return fmt.Errorf("Error Updating Topics: status %d\n", response.StatusCode)
    	}
    
    	fmt.Printf("\tname: %s updated\n", *updateTopicOptionsModel.TopicName)
    
    	return nil
    } 
    
    
  •     private static void updateTopic(Adminrest service, String topicName) {
    
            System.out.println("Update Topic");
    
            // Construct an instance of the UpdateTopicOptions.
            UpdateTopicOptions updateTopicOptions = new UpdateTopicOptions.Builder()
                .topicName(topicName)
                .newTotalPartitionCount(6) // Update partitions to 6.
                .build();
    
            // Invoke operation with valid options.
            Response<Void> response = service.updateTopic(updateTopicOptions).execute();
    
            // Print the results.
            if (response.getStatusCode() == HttpStatus.ACCEPTED) {
                System.out.println("\ttopic updated: " + topicName);
            } else {
                System.out.println("Error updating topic: " + topicName);
            }
        } 
    
    
  • function updateTopic(adminREST, topicName) {
      console.log('Update Topic Details');
      // Construct the params object for operation updateTopic
      const newTotalPartitionCount = 6;
      const params = {
        topicName: topicName,
        newTotalPartitionCount: newTotalPartitionCount,
      };
    
      // Call the update topic function on the service.
      const updateTopicResult = adminREST.updateTopic(params);
    
      // Look at the results of the promise.
      return updateTopicResult.then(
        result => {
          if (HTTP.STATUS_CODES[result.status] == 'Accepted') {
            console.log('\tname: ' + topicName);
          }
        },
        err => {
          console.log('\tError updating topic details: ' + topicName + 'error: ' + err);
        }
      );
    } 
    
    
  • def update_topic(service,topic_name):
        # Set up parameter values.
        new_total_partition_count = 6
        configs = []
    
        # Invoke update method.
        try:
            response = service.update_topic(
                topic_name,
                new_total_partition_count=new_total_partition_count,
                configs=configs,
            )
            if response.status_code == HTTPStatus.ACCEPTED :
                print("\ttopic updated: "+topic_name)
        except:
            print("\tError Updating Topic Details: " + topic_name)
        # func.End
    
    

Response

Expected empty response could be {}.

Status Code

  • Request was accepted.

  • The request body was invalid JSON.

  • Authentication information was missing or bad.

  • Not authorized to perform the operation.

  • The requested resource was not found.

  • The server was not able to process the request body.

  • Service was unavailable.

No Sample Response

This method does not specify any sample responses.

Get topics that are being actively mirrored.

Get topics that are being actively mirrored.

Get topics that are being actively mirrored.

Get topics that are being actively mirrored.

Get topics that are being actively mirrored.

Get topics that are being actively mirrored.

GET /admin/mirroring/active-topics
ServiceCall<MirroringActiveTopics> getMirroringActiveTopics()
get_mirroring_active_topics(self,
        **kwargs
    ) -> DetailedResponse
get_mirroring_active_topics(self,
        **kwargs
    ) -> DetailedResponse
(adminrest *AdminrestV1) GetMirroringActiveTopics(getMirroringActiveTopicsOptions *GetMirroringActiveTopicsOptions) (result *MirroringActiveTopics, response *core.DetailedResponse, err error)
(adminrest *AdminrestV1) GetMirroringActiveTopicsWithContext(ctx context.Context, getMirroringActiveTopicsOptions *GetMirroringActiveTopicsOptions) (result *MirroringActiveTopics, response *core.DetailedResponse, err error)

Authentication

This method uses the following security schemes for authentication.

Request

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

WithContext method only

No Request Parameters

This method does not accept any request parameters.

  • curl -i -X GET -H 'Authorization: Bearer ${TOKEN}' ${ADMIN_URL}/admin/mirroring/active-topics
    
  • func getMirroringActiveTopics(serviceAPI *adminrestv1.AdminrestV1) error {
    	// Construct an instance of the GetMirroringActiveTopicsOptions model
    	getMirroringActiveTopicsOptionsModel := new(adminrestv1.GetMirroringActiveTopicsOptions)
    
    	// Call GetMirroringActiveTopics.
    	result, response, operationErr := serviceAPI.GetMirroringActiveTopics(getMirroringActiveTopicsOptionsModel)
    	if operationErr != nil {
    		return fmt.Errorf("Error Listing Active Mirroring Topics: %s\n", operationErr.Error())
    	}
    
    	// Check the result.
    	if response.StatusCode != http.StatusAccepted {
    		return fmt.Errorf("Error Listing Active Mirroring Topics: status %d\n", response.StatusCode)
    	}
    
    	// Loop and print mirroring topics.
    	for _, topicName := range result.ActiveTopics {
    		fmt.Printf("\tname: %s\n", topicName)
    	}
    
    	return nil
    } 
    
    
  •     private static void listActiveMirroringTopics(Adminrest service) {
    
            System.out.println("List Active Mirroring Topics");
    
            // Construct an instance of the GetMirroringActiveTopicsOptions.
            GetMirroringActiveTopicsOptions getMirroringActiveTopicsOptions = new GetMirroringActiveTopicsOptions();
    
            // Invoke operation with valid options.
            Response<MirroringActiveTopics> response = service.getMirroringActiveTopics(getMirroringActiveTopicsOptions).execute();
    
            // Print the results.
            if (response.getStatusCode() == HttpStatus.OK) {
                for (String activeTopic : response.getResult().getActiveTopics()) {
                    System.out.println("\tname: " + activeTopic);
                }
            } else {
                System.out.println("Error listing active topics");
            }
        } 
    
    
  • function getListMirroringActiveTopics(adminREST) {
      console.log('List Active Mirroring Topic Selection\n');
      // Construct the params object for operation getMirroringActiveTopics
      const params = {};
    
      // Call the get mirroring active topic function on the service.
      const getMirroringActiveTopicsResult = adminREST.getMirroringActiveTopics(params);
    
      // Look at the results of the promise.
      return getMirroringActiveTopicsResult.then(
        result => {
          if (HTTP.STATUS_CODES[result.status] == 'OK') {
            for (const val of result.result) {
              console.log('\tname: ' + val.name);
            }
          }
        },
        err => {
          console.log('Error listing active mirroring topics selection ' + err);
        }
      );
    } 
    
    
  • def get_list_mirroring_active_topics(service):
        # Invoke active method.
        try:
            response = service.get_list_mirroring_active_topics()
            if response.status_code == HTTPStatus.OK :
                for topic in response.result: 
                     print("\t" + topic["name"])
            print("\tactive mirroring topics updated:")
        except:
            print("\tError Listing Active Mirroring Topics:")  
        # func.End
    
    

Response

Topics that are being actively mirrored.

Topics that are being actively mirrored.

Topics that are being actively mirrored.

Topics that are being actively mirrored.

Topics that are being actively mirrored.

Status Code

  • Return topics that are being actively mirrored.

  • Authentication information was missing or bad.

  • Not authorized to perform the operation.

  • The requested resource was not found.

  • Service was unavailable.

No Sample Response

This method does not specify any sample responses.

Get current topic selection for mirroring.

Get current topic selection for mirroring.

Get current topic selection for mirroring.

Get current topic selection for mirroring.

Get current topic selection for mirroring.

Get current topic selection for mirroring.

GET /admin/mirroring/topic-selection
ServiceCall<MirroringTopicSelection> getMirroringTopicSelection()
get_mirroring_topic_selection(self,
        **kwargs
    ) -> DetailedResponse
get_mirroring_topic_selection(self,
        **kwargs
    ) -> DetailedResponse
(adminrest *AdminrestV1) GetMirroringTopicSelection(getMirroringTopicSelectionOptions *GetMirroringTopicSelectionOptions) (result *MirroringTopicSelection, response *core.DetailedResponse, err error)
(adminrest *AdminrestV1) GetMirroringTopicSelectionWithContext(ctx context.Context, getMirroringTopicSelectionOptions *GetMirroringTopicSelectionOptions) (result *MirroringTopicSelection, response *core.DetailedResponse, err error)

Authentication

This method uses the following security schemes for authentication.

Request

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

No Request Parameters

This method does not accept any request parameters.

WithContext method only

No Request Parameters

This method does not accept any request parameters.

  • curl -i -X GET -H 'Authorization: Bearer ${TOKEN}' ${ADMIN_URL}/admin/mirroring/topic-selection
    
  • func listMirroringTopicSelection(serviceAPI *adminrestv1.AdminrestV1) error {
    	// Construct an instance of the GetMirroringTopicSelectionOptions model
    	getMirroringTopicSelectionOptionsModel := new(adminrestv1.GetMirroringTopicSelectionOptions)
    
    	// Call GetMirroringTopicSelection.
    	result, response, operationErr := serviceAPI.GetMirroringTopicSelection(getMirroringTopicSelectionOptionsModel)
    	if operationErr != nil {
    		return fmt.Errorf("Error Listing Mirroring Topics: %s\n", operationErr.Error())
    	}
    
    	// Check the result.
    	if response.StatusCode != http.StatusAccepted {
    		return fmt.Errorf("Error Listing Mirroring Topics: status %d\n", response.StatusCode)
    	}
    
    	// Loop and print mirroring topics.
    	for _, topicName := range result.Includes {
    		fmt.Printf("\tname: %s\n", topicName)
    	}
    
    	return nil
    } 
    
    
  •     private static void listActiveMirroringTopics(Adminrest service) {
    
            System.out.println("List Active Mirroring Topics");
    
            // Construct an instance of the GetMirroringActiveTopicsOptions.
            GetMirroringActiveTopicsOptions getMirroringActiveTopicsOptions = new GetMirroringActiveTopicsOptions();
    
            // Invoke operation with valid options.
            Response<MirroringActiveTopics> response = service.getMirroringActiveTopics(getMirroringActiveTopicsOptions).execute();
    
            // Print the results.
            if (response.getStatusCode() == HttpStatus.OK) {
                for (String activeTopic : response.getResult().getActiveTopics()) {
                    System.out.println("\tname: " + activeTopic);
                }
            } else {
                System.out.println("Error listing active topics");
            }
        } 
    
    
  • function getListMirroringActiveTopics(adminREST) {
      console.log('List Active Mirroring Topic Selection\n');
      // Construct the params object for operation getMirroringActiveTopics
      const params = {};
    
      // Call the get mirroring active topic function on the service.
      const getMirroringActiveTopicsResult = adminREST.getMirroringActiveTopics(params);
    
      // Look at the results of the promise.
      return getMirroringActiveTopicsResult.then(
        result => {
          if (HTTP.STATUS_CODES[result.status] == 'OK') {
            for (const val of result.result) {
              console.log('\tname: ' + val.name);
            }
          }
        },
        err => {
          console.log('Error listing active mirroring topics selection ' + err);
        }
      );
    } 
    
    
  • def get_list_mirroring_active_topics(service):
        # Invoke active method.
        try:
            response = service.get_list_mirroring_active_topics()
            if response.status_code == HTTPStatus.OK :
                for topic in response.result: 
                     print("\t" + topic["name"])
            print("\tactive mirroring topics updated:")
        except:
            print("\tError Listing Active Mirroring Topics:")  
        # func.End
    
    

Response

Mirroring topic selection payload.

Mirroring topic selection payload.

Mirroring topic selection payload.

Mirroring topic selection payload.

Mirroring topic selection payload.

Status Code

  • Returns topic selections as patterns.

  • Authentication information was missing or bad.

  • Not authorized to perform the operation.

  • Service was unavailable.

No Sample Response

This method does not specify any sample responses.

Replace topic selection for mirroring.

Replace topic selection for mirroring. This operation replaces the complete set of mirroring topic selections.

Replace topic selection for mirroring. This operation replaces the complete set of mirroring topic selections.

Replace topic selection for mirroring. This operation replaces the complete set of mirroring topic selections.

Replace topic selection for mirroring. This operation replaces the complete set of mirroring topic selections.

Replace topic selection for mirroring. This operation replaces the complete set of mirroring topic selections.

POST /admin/mirroring/topic-selection
ServiceCall<MirroringTopicSelection> replaceMirroringTopicSelection(ReplaceMirroringTopicSelectionOptions replaceMirroringTopicSelectionOptions)
replace_mirroring_topic_selection(self,
        *,
        includes: List[str] = None,
        **kwargs
    ) -> DetailedResponse
replace_mirroring_topic_selection(self,
        *,
        includes: List[str] = None,
        **kwargs
    ) -> DetailedResponse
(adminrest *AdminrestV1) ReplaceMirroringTopicSelection(replaceMirroringTopicSelectionOptions *ReplaceMirroringTopicSelectionOptions) (result *MirroringTopicSelection, response *core.DetailedResponse, err error)
(adminrest *AdminrestV1) ReplaceMirroringTopicSelectionWithContext(ctx context.Context, replaceMirroringTopicSelectionOptions *ReplaceMirroringTopicSelectionOptions) (result *MirroringTopicSelection, response *core.DetailedResponse, err error)

Authentication

This method uses the following security schemes for authentication.

Request

Use the ReplaceMirroringTopicSelectionOptions.Builder to create a ReplaceMirroringTopicSelectionOptions object that contains the parameter values for the replaceMirroringTopicSelection method.

Instantiate the ReplaceMirroringTopicSelectionOptions struct and set the fields to provide parameter values for the ReplaceMirroringTopicSelection method.

Topic selection patterns for mirroring.

The replaceMirroringTopicSelection options.

parameters

parameters

WithContext method only

The ReplaceMirroringTopicSelection options.

  • curl -i -X POST -H 'Content-Type: application/json' -H 'Authorization: Bearer ${TOKEN}' -d '{"includes":["^prefix1_.*","^prefix2_.*"]}'${ADMIN_URL}/admin/mirroring/topic-selection
    
  • func replaceMirroringTopicSelection(serviceAPI *adminrestv1.AdminrestV1) error {
    	// Construct an instance of the ReplaceMirroringTopicSelectionOptions model
    	replaceMirroringTopicSelectionOptionsModel := new(adminrestv1.ReplaceMirroringTopicSelectionOptions)
    	replaceMirroringTopicSelectionOptionsModel.Includes = []string{"test-topic"}
    
    	// Invoke operation with valid options model.
    	result, response, operationErr := serviceAPI.ReplaceMirroringTopicSelection(replaceMirroringTopicSelectionOptionsModel)
    	if operationErr != nil {
    		return fmt.Errorf("Error Replacing Mirroring Topics: %s\n", operationErr.Error())
    	}
    
    	// Check the result.
    	if response.StatusCode != http.StatusAccepted {
    		return fmt.Errorf("Error Replacing Mirroring Topics: status %d\n", response.StatusCode)
    	}
    
    	// Loop and print mirroring topics.
    	for _, topicName := range result.Includes {
    		fmt.Printf("\ttopic added: %s\n", topicName)
    	}
    
    	return nil
    } 
    
    
  •     private static void replaceMirroringTopicSelection(Adminrest service, String topicName) {
    
            System.out.println("Mirroring Topic Selection");
    
            // Construct an instance of the ReplaceMirroringTopicSelectionOptions.
            ReplaceMirroringTopicSelectionOptions replaceMirroringTopicSelectionOptions = new ReplaceMirroringTopicSelectionOptions.Builder()
                .includes(Arrays.asList(topicName))
                .build();
    
             // Invoke operation with valid options.
            Response<MirroringTopicSelection> response = service.replaceMirroringTopicSelection(replaceMirroringTopicSelectionOptions).execute();
    
            // Print the results.
            if (response.getStatusCode() == HttpStatus.OK) {
                for (String replaceTopic : response.getResult().includes()) {
                    System.out.println("\tname: " + replaceTopic);
                }
            } else {
                System.out.println("Error replacing mirroring topic selection: " + topicName);
            }
        } 
    
    
  • function replaceMirroringTopicSelection(adminREST, topicName) {
      console.log('Replace Mirroring Topics');
      // Construct the params object for operation replaceMirroringTopicSelection
      const includes = topicName;
      const params = {
        includes: includes,
      };
    
      // Call the replace mirroring topic selection on the service.
      const replaceMirroringTopicSelectionResult = adminREST.replaceMirroringTopicSelection(params);
    
      // Look at the results of the promise.
      return replaceMirroringTopicSelectionResult.then(
        result => {
          if (HTTP.STATUS_CODES[result.status] == 'OK') {
            console.log('\tmirroring topic selection updated ' + topicName);
          }
        },
        err => {
          console.log('Error replacing mirroring topics selection ' + err);
        }
      );
    } 
    
    
  • def replace_mirroring_topic_selection(service,topic_name):
         # Set up parameter values
        includes = [topic_name]    
        # Invoke replace method.
        try:
            response = service.replace_mirroring_topic_selection(
                includes=[topic_name],
            )
            if response.status_code == HTTPStatus.OK :
                print("\tmirroring topic selection updated: "+includes)
        except:
            print("\tError Replacing Mirroring Topics:") 
        # func.End
    
    

Response

Mirroring topic selection payload.

Mirroring topic selection payload.

Mirroring topic selection payload.

Mirroring topic selection payload.

Mirroring topic selection payload.

Status Code

  • Returns new topic selections as patterns.

  • The request body was invalid JSON.

  • Authentication information was missing or bad.

  • Not authorized to perform the operation.

  • Unsupported Content-Type provided.

  • Service was unavailable.

No Sample Response

This method does not specify any sample responses.