opensecureconf-client 2.3.0__tar.gz → 2.3.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {opensecureconf_client-2.3.0/opensecureconf_client.egg-info → opensecureconf_client-2.3.1}/PKG-INFO +1 -1
- {opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1/opensecureconf_client.egg-info}/PKG-INFO +1 -1
- {opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1}/opensecureconf_client.py +86 -40
- {opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1}/pyproject.toml +1 -1
- {opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1}/ADVANCED_EXAMPLES.md +0 -0
- {opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1}/LICENSE +0 -0
- {opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1}/MANIFEST.in +0 -0
- {opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1}/README.md +0 -0
- {opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1}/example_enhanced_usage.py +0 -0
- {opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1}/example_usage.py +0 -0
- {opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1}/opensecureconf_client.egg-info/SOURCES.txt +0 -0
- {opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1}/opensecureconf_client.egg-info/dependency_links.txt +0 -0
- {opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1}/opensecureconf_client.egg-info/requires.txt +0 -0
- {opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1}/opensecureconf_client.egg-info/top_level.txt +0 -0
- {opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1}/setup.cfg +0 -0
- {opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1}/setup.py +0 -0
{opensecureconf_client-2.3.0/opensecureconf_client.egg-info → opensecureconf_client-2.3.1}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opensecureconf-client
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.1
|
|
4
4
|
Summary: Python client library for OpenSecureConf encrypted configuration management API with clustering support
|
|
5
5
|
Author-email: Alessandro Pioli <alessandro.pioli+apioli-pypi@gmail.com>
|
|
6
6
|
Maintainer-email: Alessandro Pioli <alessandro.pioli+apioli-pypi@gmail.com>
|
{opensecureconf_client-2.3.0 → opensecureconf_client-2.3.1/opensecureconf_client.egg-info}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: opensecureconf-client
|
|
3
|
-
Version: 2.3.
|
|
3
|
+
Version: 2.3.1
|
|
4
4
|
Summary: Python client library for OpenSecureConf encrypted configuration management API with clustering support
|
|
5
5
|
Author-email: Alessandro Pioli <alessandro.pioli+apioli-pypi@gmail.com>
|
|
6
6
|
Maintainer-email: Alessandro Pioli <alessandro.pioli+apioli-pypi@gmail.com>
|
|
@@ -13,6 +13,7 @@ Enhanced Features:
|
|
|
13
13
|
- Enhanced input validation
|
|
14
14
|
- Health check utilities
|
|
15
15
|
- Support for multiple value types (dict, str, int, bool, list)
|
|
16
|
+
- Category and environment support
|
|
16
17
|
"""
|
|
17
18
|
|
|
18
19
|
from typing import Any, Dict, List, Optional, Union
|
|
@@ -68,14 +69,12 @@ class OpenSecureConfClient:
|
|
|
68
69
|
... enable_retry=True,
|
|
69
70
|
... log_level="INFO"
|
|
70
71
|
... )
|
|
71
|
-
>>> # Dict value
|
|
72
|
-
>>> config = client.create("database", {"host": "localhost", "port": 5432}
|
|
72
|
+
>>> # Dict value with category and environment
|
|
73
|
+
>>> config = client.create("database", {"host": "localhost", "port": 5432},
|
|
74
|
+
... category="config", environment="production")
|
|
73
75
|
>>> # String value
|
|
74
|
-
>>> config = client.create("api_token", "secret-token-123"
|
|
75
|
-
|
|
76
|
-
>>> config = client.create("max_connections", 100)
|
|
77
|
-
>>> # Bool value
|
|
78
|
-
>>> config = client.create("debug_mode", True)
|
|
76
|
+
>>> config = client.create("api_token", "secret-token-123",
|
|
77
|
+
... category="auth", environment="staging")
|
|
79
78
|
"""
|
|
80
79
|
|
|
81
80
|
def __init__(
|
|
@@ -350,7 +349,8 @@ class OpenSecureConfClient:
|
|
|
350
349
|
self,
|
|
351
350
|
key: str,
|
|
352
351
|
value: Union[Dict[str, Any], str, int, bool, list],
|
|
353
|
-
category: Optional[str] = None
|
|
352
|
+
category: Optional[str] = None,
|
|
353
|
+
environment: Optional[str] = None
|
|
354
354
|
) -> Dict[str, Any]:
|
|
355
355
|
"""
|
|
356
356
|
Create a new encrypted configuration entry.
|
|
@@ -359,6 +359,7 @@ class OpenSecureConfClient:
|
|
|
359
359
|
key: Unique configuration key (1-255 characters)
|
|
360
360
|
value: Configuration data (dict, string, int, bool, or list - will be encrypted)
|
|
361
361
|
category: Optional category for grouping (max 100 characters)
|
|
362
|
+
environment: Optional environment identifier (max 100 characters)
|
|
362
363
|
|
|
363
364
|
Returns:
|
|
364
365
|
Dictionary containing the created configuration with fields:
|
|
@@ -366,22 +367,23 @@ class OpenSecureConfClient:
|
|
|
366
367
|
- key: Configuration key
|
|
367
368
|
- value: Configuration value (decrypted)
|
|
368
369
|
- category: Configuration category (if set)
|
|
370
|
+
- environment: Environment identifier (if set)
|
|
369
371
|
|
|
370
372
|
Raises:
|
|
371
373
|
ConfigurationExistsError: If configuration key already exists
|
|
372
374
|
ValueError: If key is invalid
|
|
373
375
|
|
|
374
376
|
Example:
|
|
375
|
-
>>> # Dict value
|
|
376
|
-
>>> config = client.create("database", {"host": "localhost", "port": 5432},
|
|
377
|
+
>>> # Dict value with category and environment
|
|
378
|
+
>>> config = client.create("database", {"host": "localhost", "port": 5432},
|
|
379
|
+
... category="config", environment="production")
|
|
377
380
|
>>> # String value
|
|
378
|
-
>>> config = client.create("api_token", "secret-
|
|
381
|
+
>>> config = client.create("api_token", "secret-123",
|
|
382
|
+
... category="auth", environment="staging")
|
|
379
383
|
>>> # Integer value
|
|
380
|
-
>>> config = client.create("max_retries", 3)
|
|
384
|
+
>>> config = client.create("max_retries", 3, environment="production")
|
|
381
385
|
>>> # Boolean value
|
|
382
|
-
>>> config = client.create("
|
|
383
|
-
>>> # List value
|
|
384
|
-
>>> config = client.create("allowed_ips", ["192.168.1.1", "10.0.0.1"])
|
|
386
|
+
>>> config = client.create("debug", False, category="settings", environment="dev")
|
|
385
387
|
"""
|
|
386
388
|
# Enhanced validation
|
|
387
389
|
if not key or not isinstance(key, str):
|
|
@@ -390,8 +392,10 @@ class OpenSecureConfClient:
|
|
|
390
392
|
raise ValueError("Key must be between 1 and 255 characters")
|
|
391
393
|
if category and len(category) > 100:
|
|
392
394
|
raise ValueError("Category must be max 100 characters")
|
|
395
|
+
if environment and len(environment) > 100:
|
|
396
|
+
raise ValueError("Environment must be max 100 characters")
|
|
393
397
|
|
|
394
|
-
payload = {"key": key, "value": value, "category": category}
|
|
398
|
+
payload = {"key": key, "value": value, "category": category, "environment": environment}
|
|
395
399
|
return self._make_request("POST", "/configs", json=payload)
|
|
396
400
|
|
|
397
401
|
def read(self, key: str) -> Dict[str, Any]:
|
|
@@ -412,6 +416,7 @@ class OpenSecureConfClient:
|
|
|
412
416
|
Example:
|
|
413
417
|
>>> config = client.read("database")
|
|
414
418
|
>>> print(config["value"]) # Could be any supported type
|
|
419
|
+
>>> print(config["environment"]) # e.g., "production"
|
|
415
420
|
"""
|
|
416
421
|
if not key or not isinstance(key, str):
|
|
417
422
|
raise ValueError("Key must be a non-empty string")
|
|
@@ -422,7 +427,8 @@ class OpenSecureConfClient:
|
|
|
422
427
|
self,
|
|
423
428
|
key: str,
|
|
424
429
|
value: Union[Dict[str, Any], str, int, bool, list],
|
|
425
|
-
category: Optional[str] = None
|
|
430
|
+
category: Optional[str] = None,
|
|
431
|
+
environment: Optional[str] = None
|
|
426
432
|
) -> Dict[str, Any]:
|
|
427
433
|
"""
|
|
428
434
|
Update an existing configuration entry with new encrypted value.
|
|
@@ -431,6 +437,7 @@ class OpenSecureConfClient:
|
|
|
431
437
|
key: Configuration key to update
|
|
432
438
|
value: New configuration data (dict, string, int, bool, or list - will be encrypted)
|
|
433
439
|
category: Optional new category
|
|
440
|
+
environment: Optional new environment
|
|
434
441
|
|
|
435
442
|
Returns:
|
|
436
443
|
Dictionary containing the updated configuration with decrypted value
|
|
@@ -441,18 +448,19 @@ class OpenSecureConfClient:
|
|
|
441
448
|
|
|
442
449
|
Example:
|
|
443
450
|
>>> # Update with dict
|
|
444
|
-
>>> config = client.update("database", {"host": "db.example.com", "port": 5432}
|
|
445
|
-
|
|
446
|
-
>>>
|
|
447
|
-
>>>
|
|
448
|
-
>>> config = client.update("timeout", 60)
|
|
451
|
+
>>> config = client.update("database", {"host": "db.example.com", "port": 5432},
|
|
452
|
+
... environment="production")
|
|
453
|
+
>>> # Update with string and change environment
|
|
454
|
+
>>> config = client.update("api_token", "new-token-456", environment="staging")
|
|
449
455
|
"""
|
|
450
456
|
if not key or not isinstance(key, str):
|
|
451
457
|
raise ValueError("Key must be a non-empty string")
|
|
452
458
|
if category and len(category) > 100:
|
|
453
459
|
raise ValueError("Category must be max 100 characters")
|
|
460
|
+
if environment and len(environment) > 100:
|
|
461
|
+
raise ValueError("Environment must be max 100 characters")
|
|
454
462
|
|
|
455
|
-
payload = {"value": value, "category": category}
|
|
463
|
+
payload = {"value": value, "category": category, "environment": environment}
|
|
456
464
|
return self._make_request("PUT", f"/configs/{key}", json=payload)
|
|
457
465
|
|
|
458
466
|
def delete(self, key: str) -> Dict[str, str]:
|
|
@@ -479,24 +487,35 @@ class OpenSecureConfClient:
|
|
|
479
487
|
|
|
480
488
|
return self._make_request("DELETE", f"/configs/{key}")
|
|
481
489
|
|
|
482
|
-
def list_all(self, category: Optional[str] = None) -> List[Dict[str, Any]]:
|
|
490
|
+
def list_all(self, category: Optional[str] = None, environment: Optional[str] = None) -> List[Dict[str, Any]]:
|
|
483
491
|
"""
|
|
484
|
-
List all configurations with optional category
|
|
492
|
+
List all configurations with optional category and environment filters.
|
|
485
493
|
All values are automatically decrypted.
|
|
486
494
|
|
|
487
495
|
Args:
|
|
488
496
|
category: Optional filter by category
|
|
497
|
+
environment: Optional filter by environment
|
|
489
498
|
|
|
490
499
|
Returns:
|
|
491
500
|
List of configuration dictionaries with decrypted values
|
|
492
501
|
Each value can be dict, str, int, bool, or list
|
|
493
502
|
|
|
494
503
|
Example:
|
|
495
|
-
>>>
|
|
496
|
-
>>>
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
504
|
+
>>> # List all
|
|
505
|
+
>>> configs = client.list_all()
|
|
506
|
+
>>> # Filter by category
|
|
507
|
+
>>> prod_configs = client.list_all(category="production")
|
|
508
|
+
>>> # Filter by environment
|
|
509
|
+
>>> staging_configs = client.list_all(environment="staging")
|
|
510
|
+
>>> # Filter by both
|
|
511
|
+
>>> configs = client.list_all(category="database", environment="production")
|
|
512
|
+
"""
|
|
513
|
+
params = {}
|
|
514
|
+
if category:
|
|
515
|
+
params["category"] = category
|
|
516
|
+
if environment:
|
|
517
|
+
params["environment"] = environment
|
|
518
|
+
|
|
500
519
|
return self._make_request("GET", "/configs", params=params)
|
|
501
520
|
|
|
502
521
|
# ========================================================================
|
|
@@ -512,7 +531,8 @@ class OpenSecureConfClient:
|
|
|
512
531
|
Create multiple configurations in batch.
|
|
513
532
|
|
|
514
533
|
Args:
|
|
515
|
-
configs: List of configuration dictionaries with 'key', 'value',
|
|
534
|
+
configs: List of configuration dictionaries with 'key', 'value',
|
|
535
|
+
and optional 'category' and 'environment'
|
|
516
536
|
Value can be dict, str, int, bool, or list
|
|
517
537
|
ignore_errors: If True, continue on errors and return partial results
|
|
518
538
|
|
|
@@ -525,9 +545,12 @@ class OpenSecureConfClient:
|
|
|
525
545
|
|
|
526
546
|
Example:
|
|
527
547
|
>>> configs = [
|
|
528
|
-
... {"key": "db1", "value": {"host": "localhost"},
|
|
529
|
-
...
|
|
530
|
-
... {"key": "
|
|
548
|
+
... {"key": "db1", "value": {"host": "localhost"},
|
|
549
|
+
... "category": "db", "environment": "production"},
|
|
550
|
+
... {"key": "token", "value": "secret-123",
|
|
551
|
+
... "category": "auth", "environment": "staging"},
|
|
552
|
+
... {"key": "retries", "value": 3,
|
|
553
|
+
... "category": "config", "environment": "production"}
|
|
531
554
|
... ]
|
|
532
555
|
>>> results = client.bulk_create(configs)
|
|
533
556
|
>>> print(f"Created {len(results)} configurations")
|
|
@@ -548,7 +571,8 @@ class OpenSecureConfClient:
|
|
|
548
571
|
result = self.create(
|
|
549
572
|
key=config["key"],
|
|
550
573
|
value=config["value"],
|
|
551
|
-
category=config.get("category")
|
|
574
|
+
category=config.get("category"),
|
|
575
|
+
environment=config.get("environment")
|
|
552
576
|
)
|
|
553
577
|
results.append(result)
|
|
554
578
|
self.logger.info(f"Bulk create: created '{config['key']}'")
|
|
@@ -692,23 +716,25 @@ class OpenSecureConfClient:
|
|
|
692
716
|
try:
|
|
693
717
|
return self.read(key)
|
|
694
718
|
except ConfigurationNotFoundError:
|
|
695
|
-
return {"key": key, "value": default, "category": None}
|
|
719
|
+
return {"key": key, "value": default, "category": None, "environment": None}
|
|
696
720
|
|
|
697
|
-
def count(self, category: Optional[str] = None) -> int:
|
|
721
|
+
def count(self, category: Optional[str] = None, environment: Optional[str] = None) -> int:
|
|
698
722
|
"""
|
|
699
|
-
Count total configurations, optionally filtered by category.
|
|
723
|
+
Count total configurations, optionally filtered by category and/or environment.
|
|
700
724
|
|
|
701
725
|
Args:
|
|
702
726
|
category: Optional category filter
|
|
727
|
+
environment: Optional environment filter
|
|
703
728
|
|
|
704
729
|
Returns:
|
|
705
730
|
Number of configurations
|
|
706
731
|
|
|
707
732
|
Example:
|
|
708
733
|
>>> total = client.count()
|
|
709
|
-
>>> prod_count = client.count(
|
|
734
|
+
>>> prod_count = client.count(environment="production")
|
|
735
|
+
>>> db_prod_count = client.count(category="database", environment="production")
|
|
710
736
|
"""
|
|
711
|
-
configs = self.list_all(category=category)
|
|
737
|
+
configs = self.list_all(category=category, environment=environment)
|
|
712
738
|
return len(configs)
|
|
713
739
|
|
|
714
740
|
def list_categories(self) -> List[str]:
|
|
@@ -730,6 +756,26 @@ class OpenSecureConfClient:
|
|
|
730
756
|
categories.add(cat)
|
|
731
757
|
return sorted(list(categories))
|
|
732
758
|
|
|
759
|
+
def list_environments(self) -> List[str]:
|
|
760
|
+
"""
|
|
761
|
+
Get list of all unique environments.
|
|
762
|
+
|
|
763
|
+
Returns:
|
|
764
|
+
List of environment names
|
|
765
|
+
|
|
766
|
+
Example:
|
|
767
|
+
>>> environments = client.list_environments()
|
|
768
|
+
>>> print(f"Environments: {', '.join(environments)}")
|
|
769
|
+
Environments: production, staging, development
|
|
770
|
+
"""
|
|
771
|
+
configs = self.list_all()
|
|
772
|
+
environments = set()
|
|
773
|
+
for config in configs:
|
|
774
|
+
env = config.get("environment")
|
|
775
|
+
if env:
|
|
776
|
+
environments.add(env)
|
|
777
|
+
return sorted(list(environments))
|
|
778
|
+
|
|
733
779
|
# ========================================================================
|
|
734
780
|
# SESSION MANAGEMENT
|
|
735
781
|
# ========================================================================
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "opensecureconf-client"
|
|
7
|
-
version = "2.3.
|
|
7
|
+
version = "2.3.1"
|
|
8
8
|
description = "Python client library for OpenSecureConf encrypted configuration management API with clustering support"
|
|
9
9
|
readme = "README.md" # Updated to use the complete README
|
|
10
10
|
requires-python = ">=3.8"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|