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.2.0.tar.gz
(15.4 kB
view hashes)
Built Distribution
Close
Hashes for confluent_cloud_sdk-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ef42f82a9f97b237ce1527d807109b93297a3e704a6f7c171cd634866194cf3 |
|
MD5 | 0e3d0e0152a419374c1d4ce280f33c67 |
|
BLAKE2b-256 | 13f5e9d905c1ffcd7cb2ac6b9cc7fb0a04ba758cbcc0e798a6fd872982fa34ef |
Close
Hashes for confluent_cloud_sdk-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ba30f78efcadc86ab570adde6d16d2123ee0149647134c5b2896a56eecd5cb5 |
|
MD5 | 7470442efaa7e55af5e6cbd1c4b0d33c |
|
BLAKE2b-256 | e42ca8f76acb41b485ba371d13d59608691ccdcb1ce18d5d1fd2cd5427028b31 |