Skip to content

Latest commit

 

History

History
221 lines (164 loc) · 8.22 KB

File metadata and controls

221 lines (164 loc) · 8.22 KB

kafka-instance-sdk

Kafka Instance API

  • API version: 0.14.1-SNAPSHOT

API for interacting with Kafka Instance. Includes Produce, Consume and Admin APIs

Automatically generated by the OpenAPI Generator

Requirements

Building the API client library requires:

  1. Java 1.8+
  2. Maven/Gradle

Installation

To install the API client library to your local Maven repository, simply execute:

mvn clean install

To deploy it to a remote Maven repository instead, configure the settings of the repository and execute:

mvn clean deploy

Refer to the OSSRH Guide for more information.

Maven users

Add this dependency to your project's POM:

<dependency>
  <groupId>com.redhat.cloud</groupId>
  <artifactId>kafka-instance-sdk</artifactId>
  <version>0.14.1-SNAPSHOT</version>
  <scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file:

  repositories {
    mavenCentral()     // Needed if the 'kafka-instance-sdk' jar has been published to maven central.
    mavenLocal()       // Needed if the 'kafka-instance-sdk' jar has been published to the local maven repo.
  }

  dependencies {
     implementation "com.redhat.cloud:kafka-instance-sdk:0.14.1-SNAPSHOT"
  }

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/kafka-instance-sdk-0.14.1-SNAPSHOT.jar
  • target/lib/*.jar

Getting Started

Please follow the installation instruction and execute the following Java code:

import com.openshift.cloud.api.kas.auth.invoker.*;
import com.openshift.cloud.api.kas.auth.invoker.auth.*;
import com.openshift.cloud.api.kas.auth.models.*;
import com.openshift.cloud.api.kas.auth.AclsApi;

public class AclsApiExample {

    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();
        defaultClient.setBasePath("http://localhost");
        
        // Configure HTTP bearer authorization: Bearer
        HttpBearerAuth Bearer = (HttpBearerAuth) defaultClient.getAuthentication("Bearer");
        Bearer.setBearerToken("BEARER TOKEN");

        // Configure OAuth2 access token for authorization: OAuth2
        OAuth OAuth2 = (OAuth) defaultClient.getAuthentication("OAuth2");
        OAuth2.setAccessToken("YOUR ACCESS TOKEN");

        AclsApi apiInstance = new AclsApi(defaultClient);
        AclBinding aclBinding = new AclBinding(); // AclBinding | ACL to create.
        try {
            apiInstance.createAcl(aclBinding);
        } catch (ApiException e) {
            System.err.println("Exception when calling AclsApi#createAcl");
            System.err.println("Status code: " + e.getCode());
            System.err.println("Reason: " + e.getResponseBody());
            System.err.println("Response headers: " + e.getResponseHeaders());
            e.printStackTrace();
        }
    }
}

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
AclsApi createAcl POST /api/v1/acls Create ACL binding
AclsApi deleteAcls DELETE /api/v1/acls Delete ACL bindings
AclsApi getAclResourceOperations GET /api/v1/acls/resource-operations Retrieve allowed ACL resources and operations
AclsApi getAcls GET /api/v1/acls List ACL bindings
ErrorsApi getError GET /api/v1/errors/{errorId} Get an error by its unique ID
ErrorsApi getErrors GET /api/v1/errors Get list of errors
GroupsApi deleteConsumerGroupById DELETE /api/v1/consumer-groups/{consumerGroupId} Delete a consumer group.
GroupsApi getConsumerGroupById GET /api/v1/consumer-groups/{consumerGroupId} Get a single consumer group by its unique ID.
GroupsApi getConsumerGroups GET /api/v1/consumer-groups List of consumer groups in the Kafka instance.
GroupsApi resetConsumerGroupOffset POST /api/v1/consumer-groups/{consumerGroupId}/reset-offset Reset the offset for a consumer group.
RecordsApi consumeRecords GET /api/v1/topics/{topicName}/records Consume records from a topic
RecordsApi produceRecord POST /api/v1/topics/{topicName}/records Send a record to a topic
TopicsApi createTopic POST /api/v1/topics Creates a new topic
TopicsApi deleteTopic DELETE /api/v1/topics/{topicName} Deletes a topic
TopicsApi getTopic GET /api/v1/topics/{topicName} Retrieves a single topic
TopicsApi getTopics GET /api/v1/topics Retrieves a list of topics
TopicsApi updateTopic PATCH /api/v1/topics/{topicName} Updates a single topic

Documentation for Models

Documentation for Authorization

Authentication schemes defined for the API:

Bearer

  • Type: HTTP basic authentication

OAuth2

  • Type: OAuth
  • Flow: application
  • Authorization URL:
  • Scopes: N/A

Recommendation

It's recommended to create an instance of ApiClient per thread in a multithreaded environment to avoid any potential issues.

Author