pvw-cli 1.2.8__py3-none-any.whl

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.

Potentially problematic release.


This version of pvw-cli might be problematic. Click here for more details.

Files changed (60) hide show
  1. purviewcli/__init__.py +27 -0
  2. purviewcli/__main__.py +15 -0
  3. purviewcli/cli/__init__.py +5 -0
  4. purviewcli/cli/account.py +199 -0
  5. purviewcli/cli/cli.py +170 -0
  6. purviewcli/cli/collections.py +502 -0
  7. purviewcli/cli/domain.py +361 -0
  8. purviewcli/cli/entity.py +2436 -0
  9. purviewcli/cli/glossary.py +533 -0
  10. purviewcli/cli/health.py +250 -0
  11. purviewcli/cli/insight.py +113 -0
  12. purviewcli/cli/lineage.py +1103 -0
  13. purviewcli/cli/management.py +141 -0
  14. purviewcli/cli/policystore.py +103 -0
  15. purviewcli/cli/relationship.py +75 -0
  16. purviewcli/cli/scan.py +357 -0
  17. purviewcli/cli/search.py +527 -0
  18. purviewcli/cli/share.py +478 -0
  19. purviewcli/cli/types.py +831 -0
  20. purviewcli/cli/unified_catalog.py +3540 -0
  21. purviewcli/cli/workflow.py +402 -0
  22. purviewcli/client/__init__.py +21 -0
  23. purviewcli/client/_account.py +1877 -0
  24. purviewcli/client/_collections.py +1761 -0
  25. purviewcli/client/_domain.py +414 -0
  26. purviewcli/client/_entity.py +3545 -0
  27. purviewcli/client/_glossary.py +3233 -0
  28. purviewcli/client/_health.py +501 -0
  29. purviewcli/client/_insight.py +2873 -0
  30. purviewcli/client/_lineage.py +2138 -0
  31. purviewcli/client/_management.py +2202 -0
  32. purviewcli/client/_policystore.py +2915 -0
  33. purviewcli/client/_relationship.py +1351 -0
  34. purviewcli/client/_scan.py +2607 -0
  35. purviewcli/client/_search.py +1472 -0
  36. purviewcli/client/_share.py +272 -0
  37. purviewcli/client/_types.py +2708 -0
  38. purviewcli/client/_unified_catalog.py +5112 -0
  39. purviewcli/client/_workflow.py +2734 -0
  40. purviewcli/client/api_client.py +1295 -0
  41. purviewcli/client/business_rules.py +675 -0
  42. purviewcli/client/config.py +231 -0
  43. purviewcli/client/data_quality.py +433 -0
  44. purviewcli/client/endpoint.py +123 -0
  45. purviewcli/client/endpoints.py +554 -0
  46. purviewcli/client/exceptions.py +38 -0
  47. purviewcli/client/lineage_visualization.py +797 -0
  48. purviewcli/client/monitoring_dashboard.py +712 -0
  49. purviewcli/client/rate_limiter.py +30 -0
  50. purviewcli/client/retry_handler.py +125 -0
  51. purviewcli/client/scanning_operations.py +523 -0
  52. purviewcli/client/settings.py +1 -0
  53. purviewcli/client/sync_client.py +250 -0
  54. purviewcli/plugins/__init__.py +1 -0
  55. purviewcli/plugins/plugin_system.py +709 -0
  56. pvw_cli-1.2.8.dist-info/METADATA +1618 -0
  57. pvw_cli-1.2.8.dist-info/RECORD +60 -0
  58. pvw_cli-1.2.8.dist-info/WHEEL +5 -0
  59. pvw_cli-1.2.8.dist-info/entry_points.txt +3 -0
  60. pvw_cli-1.2.8.dist-info/top_level.txt +1 -0
@@ -0,0 +1,123 @@
1
+ import sys
2
+ import json
3
+ import os
4
+ from .sync_client import SyncPurviewClient, SyncPurviewConfig
5
+
6
+
7
+ class Endpoint:
8
+ def __init__(self):
9
+ self.app = None
10
+ self.method = None
11
+ self.endpoint = None
12
+ self.params = None
13
+ self.payload = None
14
+ self.files = None
15
+ self.headers = {}
16
+
17
+
18
+ def get_data(http_dict):
19
+ """Execute HTTP request using SyncPurviewClient"""
20
+ try:
21
+ # Get account name from environment or use default
22
+ account_name = os.getenv(
23
+ "PURVIEW_ACCOUNT_NAME", http_dict.get("account_name", "test-purview-account")
24
+ )
25
+
26
+ # Get account ID from environment (optional)
27
+ account_id = os.getenv("PURVIEW_ACCOUNT_ID")
28
+
29
+ # Create config
30
+ config = SyncPurviewConfig(
31
+ account_name=account_name,
32
+ azure_region=os.getenv("AZURE_REGION", "public"),
33
+ account_id=account_id
34
+ )
35
+
36
+ # Create synchronous client
37
+ client = SyncPurviewClient(config)
38
+
39
+ # Make the request
40
+ # If debug enabled via PURVIEWCLI_DEBUG env var, print helpful diagnostics
41
+ debug = os.getenv("PURVIEWCLI_DEBUG")
42
+ if debug:
43
+ try:
44
+ base_info = {
45
+ "app": http_dict.get("app"),
46
+ "method": http_dict.get("method", "GET"),
47
+ "endpoint": http_dict.get("endpoint", "/"),
48
+ "params": http_dict.get("params"),
49
+ "payload": http_dict.get("payload"),
50
+ }
51
+ print("[PURVIEWCLI DEBUG] Request:", json.dumps(base_info, default=str, indent=2))
52
+ except Exception:
53
+ print("[PURVIEWCLI DEBUG] Request: (could not serialize request info)")
54
+
55
+ result = client.make_request(
56
+ method=http_dict.get("method", "GET"),
57
+ endpoint=http_dict.get("endpoint", "/"),
58
+ params=http_dict.get("params"),
59
+ json=http_dict.get("payload"),
60
+ )
61
+
62
+ if debug:
63
+ try:
64
+ print("[PURVIEWCLI DEBUG] Response:", json.dumps(result, default=str, indent=2))
65
+ except Exception:
66
+ print("[PURVIEWCLI DEBUG] Response: (could not serialize response)")
67
+
68
+ # The synchronous client returns a wrapper dict like
69
+ # {"status": "success", "data": <json>, "status_code": 200}
70
+ # Normalize to return the raw JSON payload when available so
71
+ # calling code (which expects the API JSON) works consistently
72
+ if isinstance(result, dict) and result.get("status") == "success" and "data" in result:
73
+ return result.get("data")
74
+
75
+ return result
76
+
77
+ except Exception as e:
78
+ return {"status": "error", "message": f"Error in real mode: {str(e)}", "data": None}
79
+
80
+
81
+ def get_json(args, param):
82
+ response = None
83
+ # Fix: Use .get() to avoid KeyError if param is missing
84
+ value = args.get(param, None)
85
+ if value is not None:
86
+ import json
87
+ try:
88
+ if isinstance(value, str):
89
+ with open(value, 'r', encoding='utf-8') as f:
90
+ response = json.load(f)
91
+ else:
92
+ response = value
93
+ except Exception:
94
+ response = None
95
+ return response
96
+
97
+
98
+ def decorator(func):
99
+ def wrapper(self, args):
100
+ func(self, args)
101
+ http_dict = {
102
+ "app": self.app,
103
+ "method": self.method,
104
+ "endpoint": self.endpoint,
105
+ "params": self.params,
106
+ "payload": self.payload,
107
+ "files": self.files,
108
+ "headers": self.headers,
109
+ }
110
+ data = get_data(http_dict)
111
+ return data
112
+
113
+ return wrapper
114
+
115
+
116
+ def no_api_call_decorator(func):
117
+ """Decorator for operations that don't require API calls"""
118
+ def wrapper(self, args):
119
+ func(self, args)
120
+ # Return success status without making HTTP request
121
+ return {"status_code": None, "message": "operation completed", "data": None}
122
+
123
+ return wrapper