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.2.tar.gz
(15.5 kB
view hashes)
Built Distribution
Close
Hashes for confluent_cloud_sdk-0.2.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | b952af243d84eb33e0c6a492dd20bad073f33f159e9139d049c7c9e9d7d0fe95 |
|
MD5 | 5999484e42c638a1a254d00d0692ae2e |
|
BLAKE2b-256 | 9b708dc4ed6f49ff879bbde24d8abb568befaeaf8adc5f9b3ec428458226a3f3 |
Close
Hashes for confluent_cloud_sdk-0.2.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a7ec05b5d05f0401b1622c31d775a30c989cead2a175c2e2c9a7cc785e8a907 |
|
MD5 | 2a26b3ef867258f513f9a83872c2ae84 |
|
BLAKE2b-256 | cfeff2fe4ac05d12cdec8fcf83923b9b64556b31a404f32e07c34bcf6cc3ecaa |