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
Release history Release notifications | RSS feed
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.2.tar.gz
(14.4 kB
view hashes)
Built Distribution
Close
Hashes for confluent_cloud_sdk-0.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a1223d6ea70e723e645789604e4a0615414f17c1ccac6af7819bf5a600d45a2 |
|
MD5 | c253309d160a3fd2ab8c541c3fb111a4 |
|
BLAKE2b-256 | eb6804b9c54ffb826554ee5cbfe5d03cea5038f02474b0fbeedc478c746b0720 |
Close
Hashes for confluent_cloud_sdk-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61d7c69d656eba3e10f94b2d899a71e23c7944b7b18f2d337dddf6cc734c26bc |
|
MD5 | e2147efb71c4665d74b4611bbecf9c90 |
|
BLAKE2b-256 | e0ebcbedb022ab212908c516a83c54d26109e74370636dcabbc039fab4d54af5 |