Conduktor Proxy API Client
Project description
cdk-proxy-api-client
API Client library to interact with Conduktor Proxy
Current version: v1beta1
Getting started
First, create a Proxy Client
from cdk_proxy_api_client.proxy_api import ApiClient, ProxyClient
api = ApiClient("localhost", port=8888, username="superUser", password="superUser")
proxy_client = ProxyClient(api)
Features
Note: we assume you are re-using the proxy_client
as shown above.
- Create new Token for a tenant
from cdk_proxy_api_client.admin_auth import AdminAuth
admin = AdminAuth(proxy_client)
admin.create_tenant_credentials("a_tenant_name")
- List all topic mappings for a tenant
from cdk_proxy_api_client.proxy_api import Multitenancy
tenants_mgmt = Multitenancy(proxy_client)
tenants = tenants_mgmt.list_tenants(as_list=True)
- Create a new mapping for a tenant
- Delete a tenant - topic mapping
- Delete all topic mappings for a tenant
from cdk_proxy_api_client.tenant_mappings import TenantTopicMappings
tenant_mappings_mgmt = TenantTopicMappings(proxy_client)
tenant_mappings_mgmt.create_tenant_topic_mapping(
"tenant_name", "logical_name", "real_name"
)
tenant_mappings_mgmt.delete_tenant_topic_mapping("tenant_name", "logical_name")
Testing
The testing is for now very manual. See e2e_testing.py
Pytest will be added later on
Tools & CLI
To simplify the usage of the client, you can use some CLI commands
usage: CDK Proxy CLI [-h] [--format OUTPUT_FORMAT] --username USERNAME --password PASSWORD --url URL {auth,tenant-topic-mappings,tenants} ...
positional arguments:
{auth,tenant-topic-mappings,tenants}
Resources to manage
auth Manages proxy tenant token
tenant-topic-mappings
Manages tenant mappings
tenants Manage tenants
optional arguments:
-h, --help show this help message and exit
--format OUTPUT_FORMAT, --output-format OUTPUT_FORMAT
output format
--username USERNAME
--password PASSWORD
--url URL
cdk-cli tenant-topic-mappings
usage: CDK Proxy CLI tenant-topic-mappings [-h] {list,create,import-from-tenants-config,import-from-tenant,delete-all-mappings,delete-topic-mapping} ...
positional arguments:
{list,create,import-from-tenants-config,import-from-tenant,delete-all-mappings,delete-topic-mapping}
Mappings management
list List tenant mappings
create Create a new tenant mapping
import-from-tenants-config
Create topic mappings from existing tenants
import-from-tenant Import all topics from a existing tenant
delete-all-mappings
Delete all topics mappings for a given tenant
delete-topic-mapping
Delete a topic mapping for a given tenant
optional arguments:
-h, --help show this help message and exit
import-from-tenants-config
This command uses a configuration file that will be used to propagate mappings from one/multiple existing tenants to another.
example file:
---
# example.config.yaml
tenant_name: application-01
ignore_duplicates_conflict: true
mappings:
- logicalTopicName: data.stock
physicalTopicName: data.stock
readOnly: true
cdk-cli --username ${PROXY_USERNAME} \
--password ${PROXY_PASSWORD} \
--url ${PROXY_URL} \
tenant-topic-mappings import-from-tenants-config -f example.config.yaml
cdk-cli auth
cdk-cli auth --help
usage: CDK Proxy CLI auth [-h] {create} ...
positional arguments:
{create} Token actions to execute
create Create a new tenant proxy JWT Token
optional arguments:
-h, --help show this help message and exit
cdk-cli-create-tenant-token
Create a new user tenant token
cdk-cli \
--username ${PROXY_USERNAME} \
--password ${PROXY_PASSWORD} \
--url ${PROXY_URL} \
auth create \
--lifetime-in-seconds 3600 \
--tenant-name js-fin-panther-stg
cdk-cli tenants
Manage tenants
cdk-cli tenants --help
usage: CDK Proxy CLI tenants [-h] {list} ...
positional arguments:
{list} Manage tenants
list List tenants
optional arguments:
-h, --help show this help message and exit
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
cdk_proxy_api_client-0.2.0.tar.gz
(18.2 kB
view hashes)
Built Distribution
Close
Hashes for cdk_proxy_api_client-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38780717af0860e3cadad725f2ea3971aae70a9fc7a0e0c3fa150ad7c56e1073 |
|
MD5 | 8aae92d63246d16de60074d9603a6dae |
|
BLAKE2b-256 | 0628e63a0284792f21c1ceb41a7282df67150acaf1cf887e88e56c79c408aa89 |
Close
Hashes for cdk_proxy_api_client-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08ac318425b1712627182eb48b962f19b6161157cd0eaece59baa7b400db0c06 |
|
MD5 | 045c64ce1e4a89c03197b18056ab5efc |
|
BLAKE2b-256 | 16ecbcc754f5ed2c7f493af59e8d3efd15eb451fb748e289347bd61e466adea9 |