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.3.tar.gz
(14.4 kB
view hashes)
Built Distribution
Close
Hashes for confluent_cloud_sdk-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0bd07c63adca5ae4184efa216b4b55240559e6d8fc9716df7c12ae26f29be688 |
|
MD5 | cf6737b3946569f6bf91d87c7b098186 |
|
BLAKE2b-256 | 22aa4d142089600dd51672e7448adddf9e07a8bd580a782ffab0b53b3d007b7e |
Close
Hashes for confluent_cloud_sdk-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f682b4e5f49908577249d59c26b05749fbcf61a8b79092183a4670fb4fe3cc4 |
|
MD5 | 789bae21e49d764957eda9da85ebd807 |
|
BLAKE2b-256 | bed17d820e9bdee5fa9f18c4946632f333abc1157850f259aebe4fe562c9d761 |