Simple Python library wrapping the Confluent Cloud CLI
pip install py-ccloud
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")
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.
We would love to have outside contributors chiming in supporting us finishing this. Please have a look at our contribution guidelines.