saucelabs / py-ccloud

Simple Python library wrapping the Confluent Cloud CLI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

py-ccloud

Language Latest Release Last Commit

Simple Python library wrapping the Confluent Cloud CLI

Installation

pip install py-ccloud

Usage example

Setup your Confluent Cloud credentials in environment variables:

export CCLOUD_EMAIL=...
export CCLOUD_PASSWORD=...

Login and execute action:

import ccloud
ccloud.login()
ccloud.list_clusters()
ccloud.create_topic("myTopic", "myCluster")

Documentation:

ccould.login()

Logs in to Confluent Cloud account enabling usage of ccloud.

ccloud.logut()

Logs out from Confluent Cloud account.

ccloud.list_envs()

Lists all available Confluent Cloud environments.

ccloud.list_clusters()

Lists all available clusters.

ccloud.use_env(name: str)

Start using environment by given name.

ccloud.use_cluster(name: str)

Start using cluster by given name.

ccloud.create_topic(
    name: str,
    cluster: str,
    number_of_partitions: int = 3,
    config: Optional[Dict] = None)

Creates topic with given name on a given cluster. Number of partitions can be provided. Config can be provided to fulfill the need of less used parameters: https://docs.confluent.io/ccloud-cli/current/command-reference/kafka/topic/ccloud_kafka_topic_create.html

ccloud.delete_topic(name: str, cluster: str)

Deletes topic with given name on a given cluster.

ccloud.create_service_account(name: str, description: str)

Creates a service account with a given name and description.

ccloud.list_service_accounts()

Lists all available service accounts

ccloud.delete_service_account(name: str)

Deletes a service account by name.

ccloud.create_topic_acl(
    service_account: str,
    topic: str,
    operation: str,
    prefix: bool = False)

Creates an ACL for a service account to perform given operation a topic. Operation might be e.g. READ, WRITE, DESCRIBE Set prefix=True if you want to give access to a family of topics.

ccloud.delete_topic_acl(
    service_account: str,
    topic: str,
    operation: str,
    prefix: bool = False)

Deletes operation's ACL for a service account to a topic.

ccloud.create_consumer_group_acl(
    service_account: str,
    consumer_group: str,
    operation: str,
    prefix: bool = False)

Creates ACL for a consumer group like create_topic_acl for topic.

ccloud.delete_consumer_group_acl(
    service_account: str,
    consumer_group: str,
    operation: str,
    prefix: bool = False)

Deletes operation's ACL for a service account to a consumer group.

Contributing

We would love to have outside contributors chiming in supporting us finishing this. Please have a look at our contribution guidelines.

About

Simple Python library wrapping the Confluent Cloud CLI

License:MIT License


Languages

Language:Python 100.0%