Skip to main content

Confluent Cloud API SDK

Project description

SDK to interact with Confluent Cloud API

Installation

pip install confluent-cloud-sdk

Usage examples

For more details, see docs/usage.rst

Imports

To use Confluent Admin API SDK in a project

from confluent_cloud_sdk.client_factory import ConfluentClient
from confluent_cloud_sdk.confluent_iam_v2 import ApiKey
from confluent_cloud_sdk.confluent_iam_v2 import ServiceAccount

Initialize connection

client = ConfluentClient(
    "cloud_key_key",
    "cloud_key_secret",
)

List all service accounts

accounts_request = ServiceAccount(client, None).list()
for account in accounts_request.json()["data"]
    print(account)

Create a new service account

new_service_account = ServiceAccount(
    client, display_name="test_client", description="A simple service account"
)
try:
    new_service_account.create() # we try to create the user. If already exists, there will be conflict.
except GenericConflict:
    new_service_account.set_from_read()

print("SVC ACCOUNT ID IS", new_service_account.obj_id)

List all API Keys of the service account

new_service_account.import_api_keys()
for key in new_service._api_keys:
    print(key.id)

Create a new API Key for the service account for a given resource

new_api_key = ApiKey(client, display_name="new-test-key")
new_api_key.create(
    owner_id=new_service_account.obj_id,
    resource_id="cluster_id",
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

confluent_cloud_sdk-0.1.1.tar.gz (14.3 kB view hashes)

Uploaded Source

Built Distribution

confluent_cloud_sdk-0.1.1-py3-none-any.whl (17.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page