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.1.tar.gz
(15.4 kB
view hashes)
Built Distribution
Close
Hashes for confluent_cloud_sdk-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | baec0742188dece719fb9911000555aa943513f38f5ec51ee7aca208828364fb |
|
MD5 | 2c561e775401470373729fbc3e60de54 |
|
BLAKE2b-256 | 004ec8aab03b68fc9605fe95dfc6df60a3b187f925230c4572b4ba0161e96c61 |
Close
Hashes for confluent_cloud_sdk-0.2.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d203f0adc7a5ffbc65ee764b783d88ab1e66730090daba9cbb6c47f7b256d2d8 |
|
MD5 | 90425722ebed9930494e8bb348413b70 |
|
BLAKE2b-256 | a4424433d10cbb5f970dcb10f97d81b45e1ba83ce1b23d367aa3634711c1bc21 |