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.1.tar.gz
(14.3 kB
view hashes)
Built Distribution
Close
Hashes for confluent_cloud_sdk-0.1.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8d0f3f45ec57b41aa86af3339b41b88ccb25569530de18432564ddf921cf7f3 |
|
MD5 | 0647e52686a25059116556c63d50eb78 |
|
BLAKE2b-256 | bbf9cdc1e07e6740a1ca32104f5d7e58bb87d4b5188ac71a0637ddca82c16fda |
Close
Hashes for confluent_cloud_sdk-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6b06a63f253d90cfa9ddaa7bfbc90ba42521651e01a6d3be27e274b64a3fcbf |
|
MD5 | 51d7e60314c69057a75b70493e94a3c2 |
|
BLAKE2b-256 | 077422ca87703ed2d593658a924646694f8fb7bbbd7f8dae9cc00d1cffb5c61e |