Skip to content

Latest commit

 

History

History
199 lines (158 loc) · 8.28 KB

File metadata and controls

199 lines (158 loc) · 8.28 KB

rhoas-kafka-instance-sdk

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

This Python package is automatically generated by the OpenAPI Generator project:

  • API version: 0.13.1
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.PythonClientCodegen

Requirements.

Python >=3.6

Installation & Usage

pip install

The package is hosted on PyPI, you can install directly using:

pip install rhoas-sdks

Then import the package:

import rhoas_kafka_instance_sdk

Getting Started

Please follow the installation procedure and then run the following:

import time
import rhoas_kafka_instance_sdk
from pprint import pprint
from rhoas_kafka_instance_sdk.api import acls_api
from rhoas_kafka_instance_sdk.model.acl_binding import AclBinding
from rhoas_kafka_instance_sdk.model.acl_binding_list_page import AclBindingListPage
from rhoas_kafka_instance_sdk.model.error import Error
from rhoas_kafka_instance_sdk.model.sort_direction import SortDirection
# Defining the host is optional and defaults to http://localhost
# See configuration.py for a list of all supported configuration parameters.
configuration = rhoas_kafka_instance_sdk.Configuration(
    host = "http://localhost"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure Bearer authorization (JWT): Bearer
configuration = rhoas_kafka_instance_sdk.Configuration(
    access_token = 'YOUR_BEARER_TOKEN'
)

# Configure OAuth2 access token for authorization: OAuth2
configuration = rhoas_kafka_instance_sdk.Configuration(
    host = "http://localhost"
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'


# Enter a context with an instance of the API client
with rhoas_kafka_instance_sdk.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = acls_api.AclsApi(api_client)
    acl_binding = AclBinding(None) # AclBinding | ACL to create.

    try:
        # Create ACL binding
        api_instance.create_acl(acl_binding)
    except rhoas_kafka_instance_sdk.ApiException as e:
        print("Exception when calling AclsApi->create_acl: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
AclsApi create_acl POST /api/v1/acls Create ACL binding
AclsApi delete_acls DELETE /api/v1/acls Delete ACL bindings
AclsApi get_acl_resource_operations GET /api/v1/acls/resource-operations Retrieve allowed ACL resources and operations
AclsApi get_acls GET /api/v1/acls List ACL bindings
ErrorsApi get_error GET /api/v1/errors/{errorId} Get an error by its unique ID
ErrorsApi get_errors GET /api/v1/errors Get list of errors
GroupsApi delete_consumer_group_by_id DELETE /api/v1/consumer-groups/{consumerGroupId} Delete a consumer group.
GroupsApi get_consumer_group_by_id GET /api/v1/consumer-groups/{consumerGroupId} Get a single consumer group by its unique ID.
GroupsApi get_consumer_groups GET /api/v1/consumer-groups List of consumer groups in the Kafka instance.
GroupsApi reset_consumer_group_offset POST /api/v1/consumer-groups/{consumerGroupId}/reset-offset Reset the offset for a consumer group.
RecordsApi consume_records GET /api/v1/topics/{topicName}/records Consume records from a topic
RecordsApi produce_record POST /api/v1/topics/{topicName}/records Send a record to a topic
TopicsApi create_topic POST /api/v1/topics Creates a new topic
TopicsApi delete_topic DELETE /api/v1/topics/{topicName} Deletes a topic
TopicsApi get_topic GET /api/v1/topics/{topicName} Retrieves a single topic
TopicsApi get_topics GET /api/v1/topics Retrieves a list of topics
TopicsApi update_topic PATCH /api/v1/topics/{topicName} Updates a single topic

Documentation For Models

Documentation For Authorization

Bearer

  • Type: Bearer authentication (JWT)

OAuth2

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

Author

Notes for Large OpenAPI documents

If the OpenAPI document is large, imports in rhoas_kafka_instance_sdk.apis and rhoas_kafka_instance_sdk.models may fail with a RecursionError indicating the maximum recursion limit has been exceeded. In that case, there are a couple of solutions:

Solution 1: Use specific imports for apis and models like:

  • from rhoas_kafka_instance_sdk.api.default_api import DefaultApi
  • from rhoas_kafka_instance_sdk.model.pet import Pet

Solution 2: Before importing the package, adjust the maximum recursion limit as shown below:

import sys
sys.setrecursionlimit(1500)
import rhoas_kafka_instance_sdk
from rhoas_kafka_instance_sdk.apis import *
from rhoas_kafka_instance_sdk.models import *