Skip to content

Commit 291be14

Browse files
Merge pull request #282 from j3-signalroom/281-bump-the-cc-clients-python_lib-version
281 bump the cc clients python lib version
2 parents a5ba2f0 + bac506d commit 291be14

11 files changed

+49
-45
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is base on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
55

66

7+
## [0.12.04.000] - 2025-10-14
8+
### Changed
9+
- Issue [#281](https://github.com/j3-signalroom/kafka_cluster-topics-partition_count_recommender-tool/issues/281)
10+
711
## [0.12.03.000] - 2025-10-07
812
### Changed
913
- Issue [#278](https://github.com/j3-signalroom/kafka_cluster-topics-partition_count_recommender-tool/issues/278)

CHANGELOG.pdf

624 Bytes
Binary file not shown.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -627,9 +627,9 @@ sequenceDiagram
627627
628628
alt Use Confluent Cloud API Key
629629
Main->>EC: Create EnvironmentClient
630-
Main->>EC: get_environment_list()
630+
Main->>EC: get_environments()
631631
EC-->>Main: Return environments
632-
Main->>EC: get_kafka_cluster_list(env_id)
632+
Main->>EC: get_kafka_clusters(env_id)
633633
EC-->>Main: Return kafka clusters
634634
loop For each cluster
635635
Main->>EC: create_api_key(kafka_cluster_id, principal_id)

README.pdf

-24 Bytes
Binary file not shown.

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[project]
22
name = "kafka_cluster-topics-partition_count_recommender-tool"
3-
version = "0.12.00.000"
3+
version = "0.12.04.000"
44
description = "Kafka Cluster Topics Partition Count Recommender Tool"
55
readme = "README.md"
66
requires-python = ">=3.13"
77
dependencies = [
88
"authlib>=1.6.5",
99
"aws-clients-python-lib>=0.10.0.0",
1010
"cachetools>=6.2.0",
11-
"cc-clients-python-lib==0.30.1.0",
11+
"cc-clients-python-lib==0.30.3.0",
1212
"confluent-kafka>=2.11.1",
1313
"dotenv>=0.9.9",
1414
"jsonschema>=4.25.1",

src/confluent_credentials.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def fetch_kafka_credentials_via_confluent_cloud_api_key(principal_id: str,
7272
environment_client = EnvironmentClient(environment_config=environment_config)
7373
iam_client = IamClient(iam_config=environment_config)
7474

75-
http_status_code, error_message, environments = environment_client.get_environment_list()
75+
http_status_code, error_message, environments = environment_client.get_environments()
7676

7777
if http_status_code != HttpStatus.OK:
7878
logger.error("FAILED TO RETRIEVE KAFKA CREDENTIALS FROM CONFLUENT CLOUD BECAUSE THE FOLLOWING ERROR OCCURRED: %s.", error_message)
@@ -84,8 +84,8 @@ def fetch_kafka_credentials_via_confluent_cloud_api_key(principal_id: str,
8484
environments = [environment for environment in environments if environment.get("id") in environment_ids]
8585

8686
# Retrieve Kafka cluster credentials for each environment
87-
for environment in environments:
88-
http_status_code, error_message, kafka_clusters = environment_client.get_kafka_cluster_list(environment_id=environment.get("id"))
87+
for environment in environments.values():
88+
http_status_code, error_message, kafka_clusters = environment_client.get_kafka_clusters(environment_id=environment.get("id"))
8989

9090
if http_status_code != HttpStatus.OK:
9191
logger.error("FAILED TO RETRIEVE KAFKA CLUSTER LIST FOR ENVIRONMENT %s FROM CONFLUENT CLOUD BECAUSE THE FOLLOWING ERROR OCCURRED: %s.", environment.get('id'), error_message)
@@ -98,7 +98,7 @@ def fetch_kafka_credentials_via_confluent_cloud_api_key(principal_id: str,
9898
kafka_clusters = [kafka_cluster for kafka_cluster in kafka_clusters if kafka_cluster.get("id") in kafka_cluster_ids]
9999

100100
# Retrieve API key pair for each Kafka cluster
101-
for kafka_cluster in kafka_clusters:
101+
for kafka_cluster in kafka_clusters.values():
102102
http_status_code, error_message, api_key_pair = iam_client.create_api_key(resource_id=kafka_cluster.get("id"),
103103
principal_id=principal_id,
104104
display_name=f"Temporary API Key for Kafka Cluster {kafka_cluster.get('display_name')} ({kafka_cluster.get('id')}) in Environment {environment.get('display_name')} for Principal {principal_id}",
@@ -158,7 +158,7 @@ def fetch_schema_registry_via_confluent_cloud_api_key(principal_id: str,
158158
iam_client = IamClient(iam_config=resource_config)
159159

160160
# Retrieve the list of environments
161-
http_status_code, error_message, environments = environment_client.get_environment_list()
161+
http_status_code, error_message, environments = environment_client.get_environments()
162162
if http_status_code != HttpStatus.OK:
163163
logger.error("FAILED TO RETRIEVE SCHEMA REGISTRY CREDENTIALS FROM CONFLUENT CLOUD BECAUSE THE FOLLOWING ERROR OCCURRED: %s.", error_message)
164164
return {}
@@ -175,7 +175,7 @@ def fetch_schema_registry_via_confluent_cloud_api_key(principal_id: str,
175175
sr_client = SchemaRegistryClient(resource_config)
176176

177177
# Retrieve Kafka cluster credentials for each environment
178-
for environment in environments:
178+
for environment in environments.values():
179179
http_status_code, error_message, sr_clusters = sr_client.get_schema_registry_cluster_list(environment_id=environment["id"])
180180

181181
if http_status_code != HttpStatus.OK:

tests/test_environment_client.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ class TestEnvironmentClient:
3232
"""Test Suite for the EnvironmentClient class."""
3333

3434
def test_get_all_environments_with_kafka_clusters(self, environment_client):
35-
"""Test the get_environment_list() and get_kafka_cluster_list() functions."""
35+
"""Test the get_environments() and get_kafka_clusters() functions."""
3636

37-
http_status_code, error_message, environments = environment_client.get_environment_list()
37+
http_status_code, error_message, environments = environment_client.get_environments()
3838
try:
3939
assert http_status_code == HttpStatus.OK, f"HTTP Status Code: {http_status_code}"
4040

41-
for environment_index, environment in enumerate(environments):
41+
for environment_index, environment in enumerate(environments.values()):
4242
beautified = json.dumps(environment, indent=4, sort_keys=True)
4343
logger.info("%d of %d Environment: %s", environment_index + 1, len(environments), beautified)
4444

45-
http_status_code, error_message, kafka_clusters = environment_client.get_kafka_cluster_list(environment_id=environment["id"])
45+
http_status_code, error_message, kafka_clusters = environment_client.get_kafka_clusters(environment_id=environment["id"])
4646

4747
try:
4848
assert http_status_code == HttpStatus.OK, f"HTTP Status Code: {http_status_code}"
4949

50-
for kafka_cluster_index, kafka_cluster in enumerate(kafka_clusters):
50+
for kafka_cluster_index, kafka_cluster in enumerate(kafka_clusters.values()):
5151
beautified = json.dumps(kafka_cluster, indent=4, sort_keys=True)
5252
logger.info("Environment '%s' %d of %d Kafka Cluster: %s", environment["display_name"], kafka_cluster_index + 1, len(kafka_clusters), beautified)
5353
except AssertionError as e:

tests/test_fetch_kafka_credentials_via_confluent_cloud_api_key.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -114,10 +114,10 @@ def test_successful_fetch_all_environments(
114114
mock_iam_client.return_value = mock_iam_client_instance
115115

116116

117-
mock_client_instance.get_environment_list.return_value = (
117+
mock_client_instance.get_environments.return_value = (
118118
HttpStatus.OK, None, mock_environments
119119
)
120-
mock_client_instance.get_kafka_cluster_list.return_value = (
120+
mock_client_instance.get_kafka_clusters.return_value = (
121121
HttpStatus.OK, None, [mock_kafka_clusters[0]]
122122
)
123123
mock_iam_client_instance.create_api_key.return_value = (
@@ -149,7 +149,7 @@ def test_environment_list_failure(
149149
mock_client_instance = Mock()
150150
mock_environment_client.return_value = mock_client_instance
151151

152-
mock_client_instance.get_environment_list.return_value = (
152+
mock_client_instance.get_environments.return_value = (
153153
HttpStatus.INTERNAL_SERVER_ERROR, "API Error", []
154154
)
155155

@@ -172,10 +172,10 @@ def test_kafka_cluster_list_failure(
172172
mock_client_instance = Mock()
173173
mock_environment_client.return_value = mock_client_instance
174174

175-
mock_client_instance.get_environment_list.return_value = (
175+
mock_client_instance.get_environments.return_value = (
176176
HttpStatus.OK, None, mock_environments
177177
)
178-
mock_client_instance.get_kafka_cluster_list.return_value = (
178+
mock_client_instance.get_kafka_clusters.return_value = (
179179
HttpStatus.INTERNAL_SERVER_ERROR, "Cluster API Error", []
180180
)
181181

@@ -204,10 +204,10 @@ def test_environment_filter(
204204
mock_iam_client_instance = Mock()
205205
mock_iam_client.return_value = mock_iam_client_instance
206206

207-
mock_client_instance.get_environment_list.return_value = (
207+
mock_client_instance.get_environments.return_value = (
208208
HttpStatus.OK, None, mock_environments
209209
)
210-
mock_client_instance.get_kafka_cluster_list.return_value = (
210+
mock_client_instance.get_kafka_clusters.return_value = (
211211
HttpStatus.OK, None, [mock_kafka_clusters[0]]
212212
)
213213
mock_iam_client_instance.create_api_key.return_value = (
@@ -223,7 +223,7 @@ def test_environment_filter(
223223

224224
# Assert - only one environment should be processed
225225
assert len(result) == 1
226-
mock_client_instance.get_kafka_cluster_list.assert_called_once_with(
226+
mock_client_instance.get_kafka_clusters.assert_called_once_with(
227227
environment_id="env-1"
228228
)
229229

@@ -244,10 +244,10 @@ def test_kafka_cluster_filter(
244244
mock_iam_client_instance = Mock()
245245
mock_iam_client.return_value = mock_iam_client_instance
246246

247-
mock_client_instance.get_environment_list.return_value = (
247+
mock_client_instance.get_environments.return_value = (
248248
HttpStatus.OK, None, [mock_environments[0]]
249249
)
250-
mock_client_instance.get_kafka_cluster_list.return_value = (
250+
mock_client_instance.get_kafka_clusters.return_value = (
251251
HttpStatus.OK, None, mock_kafka_clusters
252252
)
253253
mock_iam_client_instance.create_api_key.return_value = (
@@ -281,10 +281,10 @@ def test_forbidden_access(
281281
mock_iam_client_instance = Mock()
282282
mock_iam_client.return_value = mock_iam_client_instance
283283

284-
mock_client_instance.get_environment_list.return_value = (
284+
mock_client_instance.get_environments.return_value = (
285285
HttpStatus.OK, None, [mock_environments[0]]
286286
)
287-
mock_client_instance.get_kafka_cluster_list.return_value = (
287+
mock_client_instance.get_kafka_clusters.return_value = (
288288
HttpStatus.OK, None, [mock_kafka_clusters[0]]
289289
)
290290
mock_iam_client_instance.create_api_key.return_value = (
@@ -315,10 +315,10 @@ def test_api_key_creation_failure_returns_empty(
315315
mock_iam_client_instance = Mock()
316316
mock_iam_client.return_value = mock_iam_client_instance
317317

318-
mock_client_instance.get_environment_list.return_value = (
318+
mock_client_instance.get_environments.return_value = (
319319
HttpStatus.OK, None, [mock_environments[0]]
320320
)
321-
mock_client_instance.get_kafka_cluster_list.return_value = (
321+
mock_client_instance.get_kafka_clusters.return_value = (
322322
HttpStatus.OK, None, mock_kafka_clusters
323323
)
324324

@@ -360,10 +360,10 @@ def test_cleanup_deletion_failure(
360360
mock_iam_client_instance = Mock()
361361
mock_iam_client.return_value = mock_iam_client_instance
362362

363-
mock_client_instance.get_environment_list.return_value = (
363+
mock_client_instance.get_environments.return_value = (
364364
HttpStatus.OK, None, [mock_environments[0]]
365365
)
366-
mock_client_instance.get_kafka_cluster_list.return_value = (
366+
mock_client_instance.get_kafka_clusters.return_value = (
367367
HttpStatus.OK, None, mock_kafka_clusters
368368
)
369369

@@ -402,10 +402,10 @@ def test_multiple_environment_ids_filter(
402402
mock_iam_client_instance = Mock()
403403
mock_iam_client.return_value = mock_iam_client_instance
404404

405-
mock_client_instance.get_environment_list.return_value = (
405+
mock_client_instance.get_environments.return_value = (
406406
HttpStatus.OK, None, mock_environments
407407
)
408-
mock_client_instance.get_kafka_cluster_list.return_value = (
408+
mock_client_instance.get_kafka_clusters.return_value = (
409409
HttpStatus.OK, None, [mock_kafka_clusters[0]]
410410
)
411411
mock_iam_client_instance.create_api_key.return_value = (
@@ -433,11 +433,11 @@ def test_no_kafka_credentials_found(
433433
mock_client_instance = Mock()
434434
mock_environment_client.return_value = mock_client_instance
435435

436-
mock_client_instance.get_environment_list.return_value = (
436+
mock_client_instance.get_environments.return_value = (
437437
HttpStatus.OK, None, mock_environments
438438
)
439439
# No Kafka clusters in environments
440-
mock_client_instance.get_kafka_cluster_list.return_value = (
440+
mock_client_instance.get_kafka_clusters.return_value = (
441441
HttpStatus.OK, None, []
442442
)
443443

tests/test_iam_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,14 @@ def test_creating_and_deleting_kafka_api_keys(self, iam_client, environment_clie
5151

5252
environments_with_kafka_clusters = {}
5353

54-
http_status_code, error_message, environments = environment_client.get_environment_list()
54+
http_status_code, error_message, environments = environment_client.get_environments()
5555
try:
5656
assert http_status_code == HttpStatus.OK, f"HTTP Status Code: {http_status_code}"
5757

5858
logger.info("Environments: %d", len(environments))
5959

60-
for environment in environments:
61-
http_status_code, error_message, kafka_clusters = environment_client.get_kafka_cluster_list(environment_id=environment["id"])
60+
for environment in environments.values():
61+
http_status_code, error_message, kafka_clusters = environment_client.get_kafka_clusters(environment_id=environment["id"])
6262

6363
try:
6464
assert http_status_code == HttpStatus.OK, f"HTTP Status Code: {http_status_code}"
@@ -77,7 +77,7 @@ def test_creating_and_deleting_kafka_api_keys(self, iam_client, environment_clie
7777

7878
for _, kafka_clusters in environments_with_kafka_clusters.items():
7979
kafka_cluster_count = len(kafka_clusters)
80-
for index, kafka_cluster in enumerate(kafka_clusters):
80+
for index, kafka_cluster in enumerate(kafka_clusters.values()):
8181
http_status_code, error_message, api_key_pair = iam_client.create_api_key(resource_id=kafka_cluster["id"],
8282
principal_id=principal_id,
8383
display_name=f"Test {environment['display_name']} Kafka API Key",

tests/test_schema_registry_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class TestSchemaRegistryClient:
4545
def test_getting_all_schema_registry_clusters(self, sr_client, environment_client):
4646
"""Test the get_schema_registry_cluster_list() function."""
4747

48-
http_status_code, error_message, environments = environment_client.get_environment_list()
48+
http_status_code, error_message, environments = environment_client.get_environments()
4949
try:
5050
assert http_status_code == HttpStatus.OK, f"HTTP Status Code: {http_status_code}"
5151

0 commit comments

Comments
 (0)