policy-weaver 0.1.0__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.
- policy_weaver-0.1.0/LICENSE +21 -0
- policy_weaver-0.1.0/PKG-INFO +87 -0
- policy_weaver-0.1.0/README.md +54 -0
- policy_weaver-0.1.0/policy_weaver.egg-info/PKG-INFO +87 -0
- policy_weaver-0.1.0/policy_weaver.egg-info/SOURCES.txt +21 -0
- policy_weaver-0.1.0/policy_weaver.egg-info/dependency_links.txt +1 -0
- policy_weaver-0.1.0/policy_weaver.egg-info/requires.txt +5 -0
- policy_weaver-0.1.0/policy_weaver.egg-info/top_level.txt +1 -0
- policy_weaver-0.1.0/policyweaver/__init__.py +0 -0
- policy_weaver-0.1.0/policyweaver/models/__init__.py +0 -0
- policy_weaver-0.1.0/policyweaver/models/common.py +131 -0
- policy_weaver-0.1.0/policyweaver/models/databricksmodel.py +72 -0
- policy_weaver-0.1.0/policyweaver/models/fabricmodel.py +77 -0
- policy_weaver-0.1.0/policyweaver/policyweaver.py +186 -0
- policy_weaver-0.1.0/policyweaver/sources/__init__.py +0 -0
- policy_weaver-0.1.0/policyweaver/sources/databricksclient.py +336 -0
- policy_weaver-0.1.0/policyweaver/support/__init__.py +0 -0
- policy_weaver-0.1.0/policyweaver/support/fabricapiclient.py +50 -0
- policy_weaver-0.1.0/policyweaver/support/microsoftgraphclient.py +31 -0
- policy_weaver-0.1.0/policyweaver/support/restapiclient.py +51 -0
- policy_weaver-0.1.0/policyweaver/weavercore.py +28 -0
- policy_weaver-0.1.0/pyproject.toml +130 -0
- policy_weaver-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Microsoft Corporation.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: policy-weaver
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Policy Weaver for Microsoft Fabric
|
|
5
|
+
Author-email: Tonio Lora <tonio.lora@microsoft.com>, Christopher Price <chriprice@microsoft.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
Project-URL: Homepage, https://github.com/microsoft/Policy-Weaver
|
|
8
|
+
Project-URL: Documentation, https://github.com/microsoft/Policy-Weaver/blob/main/docs/PolicyWeaver.md
|
|
9
|
+
Project-URL: Repository, https://github.com/microsoft/Policy-Weaver.git
|
|
10
|
+
Project-URL: Issues, https://github.com/microsoft/Policy-Weaver/issues
|
|
11
|
+
Keywords: Fabric,Fabric Access Policy,Databricks,BigQuery,Snowflake
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Information Technology
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: Topic :: Software Development
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Programming Language :: Python
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Requires-Python: >=3.11.8
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: azure-identity>=1.19.0
|
|
29
|
+
Requires-Dist: databricks-sdk>=0.40.0
|
|
30
|
+
Requires-Dist: msgraph-sdk>=1.16.0
|
|
31
|
+
Requires-Dist: pydantic>=2.10.5
|
|
32
|
+
Requires-Dist: python-dotenv>=1.0.1
|
|
33
|
+
|
|
34
|
+
# Policy Weaver
|
|
35
|
+
|
|
36
|
+
## Overview
|
|
37
|
+
|
|
38
|
+
Microsoft Fabric introduced mirroring as a managed, friction-free way of synchronizing data from a diverse set of data & analytic platforms to Fabric via OneLake.
|
|
39
|
+
|
|
40
|
+
While mirroring provides all the capabilities required to keep data in sync, data access policies defined by the source system are out-of-scope and must be handled manually.
|
|
41
|
+
|
|
42
|
+
Manually handling of these data access policies presents a challenge for ensuring consistent security across the data estate while reducing risks or vulnerabilities associated with out-of-sync security policies.
|
|
43
|
+
|
|
44
|
+
The Policy Weaver project addresses this by automating the synchronzation of data access policies from source to Fabric in a transparent and auditable mmaner.
|
|
45
|
+
|
|
46
|
+
Designed as a pluggable framework, Policy Weaver provides connectors that handle the export of access policies from a configured source before applying them to the mirror data within Fabric.
|
|
47
|
+
|
|
48
|
+
Policy Weaver will initially supports the following sources:
|
|
49
|
+
- [Databricks Unity Catalog]()
|
|
50
|
+
- BigQuery
|
|
51
|
+
- Snowflake
|
|
52
|
+
|
|
53
|
+
<mark><b>Note:</b>Policy Weaver is limited to read-only policies. Support for row filter and column-masking policies will be added in a future version.</mark>
|
|
54
|
+
|
|
55
|
+
This project is made available as a Python library and can be run from anywhere with a Python runtime.
|
|
56
|
+
|
|
57
|
+
For more information on getting started, please see the [Getting Started]() documentation.
|
|
58
|
+
|
|
59
|
+
## OneLake Data Access Roles Overview
|
|
60
|
+
|
|
61
|
+
Policy Weaver uses OneLake Data Access Roles to coalesce source system security policies into access policies that apply uniformly across the Fabric platform. With Data Access Roles, security policies are defined as role-based access controls (RBAC) on the data stored in OneLake.
|
|
62
|
+
|
|
63
|
+
When data is accessed from anywhere within Fabric, the defined RBAC policies are enforced. This means that data whether is accessed from a Notebook, SQL Endpoint or Semantic model the security policies defined by the source system are enforced consistently as expected.
|
|
64
|
+
|
|
65
|
+
For more details on OneLake Data Access policies, please see official Microsoft documentation: [OneLake Security Overview](https://learn.microsoft.com/en-us/fabric/onelake/security/get-started-security)
|
|
66
|
+
|
|
67
|
+
## Contributing
|
|
68
|
+
|
|
69
|
+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
|
70
|
+
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
|
71
|
+
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
|
|
72
|
+
|
|
73
|
+
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
|
|
74
|
+
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
|
|
75
|
+
provided by the bot. You will only need to do this once across all repos using our CLA.
|
|
76
|
+
|
|
77
|
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
|
78
|
+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
|
79
|
+
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
|
80
|
+
|
|
81
|
+
## Trademarks
|
|
82
|
+
|
|
83
|
+
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
|
|
84
|
+
trademarks or logos is subject to and must follow
|
|
85
|
+
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
86
|
+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
87
|
+
Any use of third-party trademarks or logos are subject to those third-party's policies.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Policy Weaver
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Microsoft Fabric introduced mirroring as a managed, friction-free way of synchronizing data from a diverse set of data & analytic platforms to Fabric via OneLake.
|
|
6
|
+
|
|
7
|
+
While mirroring provides all the capabilities required to keep data in sync, data access policies defined by the source system are out-of-scope and must be handled manually.
|
|
8
|
+
|
|
9
|
+
Manually handling of these data access policies presents a challenge for ensuring consistent security across the data estate while reducing risks or vulnerabilities associated with out-of-sync security policies.
|
|
10
|
+
|
|
11
|
+
The Policy Weaver project addresses this by automating the synchronzation of data access policies from source to Fabric in a transparent and auditable mmaner.
|
|
12
|
+
|
|
13
|
+
Designed as a pluggable framework, Policy Weaver provides connectors that handle the export of access policies from a configured source before applying them to the mirror data within Fabric.
|
|
14
|
+
|
|
15
|
+
Policy Weaver will initially supports the following sources:
|
|
16
|
+
- [Databricks Unity Catalog]()
|
|
17
|
+
- BigQuery
|
|
18
|
+
- Snowflake
|
|
19
|
+
|
|
20
|
+
<mark><b>Note:</b>Policy Weaver is limited to read-only policies. Support for row filter and column-masking policies will be added in a future version.</mark>
|
|
21
|
+
|
|
22
|
+
This project is made available as a Python library and can be run from anywhere with a Python runtime.
|
|
23
|
+
|
|
24
|
+
For more information on getting started, please see the [Getting Started]() documentation.
|
|
25
|
+
|
|
26
|
+
## OneLake Data Access Roles Overview
|
|
27
|
+
|
|
28
|
+
Policy Weaver uses OneLake Data Access Roles to coalesce source system security policies into access policies that apply uniformly across the Fabric platform. With Data Access Roles, security policies are defined as role-based access controls (RBAC) on the data stored in OneLake.
|
|
29
|
+
|
|
30
|
+
When data is accessed from anywhere within Fabric, the defined RBAC policies are enforced. This means that data whether is accessed from a Notebook, SQL Endpoint or Semantic model the security policies defined by the source system are enforced consistently as expected.
|
|
31
|
+
|
|
32
|
+
For more details on OneLake Data Access policies, please see official Microsoft documentation: [OneLake Security Overview](https://learn.microsoft.com/en-us/fabric/onelake/security/get-started-security)
|
|
33
|
+
|
|
34
|
+
## Contributing
|
|
35
|
+
|
|
36
|
+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
|
37
|
+
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
|
38
|
+
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
|
|
39
|
+
|
|
40
|
+
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
|
|
41
|
+
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
|
|
42
|
+
provided by the bot. You will only need to do this once across all repos using our CLA.
|
|
43
|
+
|
|
44
|
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
|
45
|
+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
|
46
|
+
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
|
47
|
+
|
|
48
|
+
## Trademarks
|
|
49
|
+
|
|
50
|
+
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
|
|
51
|
+
trademarks or logos is subject to and must follow
|
|
52
|
+
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
53
|
+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
54
|
+
Any use of third-party trademarks or logos are subject to those third-party's policies.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: policy-weaver
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Policy Weaver for Microsoft Fabric
|
|
5
|
+
Author-email: Tonio Lora <tonio.lora@microsoft.com>, Christopher Price <chriprice@microsoft.com>
|
|
6
|
+
License: MIT License
|
|
7
|
+
Project-URL: Homepage, https://github.com/microsoft/Policy-Weaver
|
|
8
|
+
Project-URL: Documentation, https://github.com/microsoft/Policy-Weaver/blob/main/docs/PolicyWeaver.md
|
|
9
|
+
Project-URL: Repository, https://github.com/microsoft/Policy-Weaver.git
|
|
10
|
+
Project-URL: Issues, https://github.com/microsoft/Policy-Weaver/issues
|
|
11
|
+
Keywords: Fabric,Fabric Access Policy,Databricks,BigQuery,Snowflake
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Information Technology
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: Topic :: Software Development
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Classifier: Programming Language :: Python
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Requires-Python: >=3.11.8
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: azure-identity>=1.19.0
|
|
29
|
+
Requires-Dist: databricks-sdk>=0.40.0
|
|
30
|
+
Requires-Dist: msgraph-sdk>=1.16.0
|
|
31
|
+
Requires-Dist: pydantic>=2.10.5
|
|
32
|
+
Requires-Dist: python-dotenv>=1.0.1
|
|
33
|
+
|
|
34
|
+
# Policy Weaver
|
|
35
|
+
|
|
36
|
+
## Overview
|
|
37
|
+
|
|
38
|
+
Microsoft Fabric introduced mirroring as a managed, friction-free way of synchronizing data from a diverse set of data & analytic platforms to Fabric via OneLake.
|
|
39
|
+
|
|
40
|
+
While mirroring provides all the capabilities required to keep data in sync, data access policies defined by the source system are out-of-scope and must be handled manually.
|
|
41
|
+
|
|
42
|
+
Manually handling of these data access policies presents a challenge for ensuring consistent security across the data estate while reducing risks or vulnerabilities associated with out-of-sync security policies.
|
|
43
|
+
|
|
44
|
+
The Policy Weaver project addresses this by automating the synchronzation of data access policies from source to Fabric in a transparent and auditable mmaner.
|
|
45
|
+
|
|
46
|
+
Designed as a pluggable framework, Policy Weaver provides connectors that handle the export of access policies from a configured source before applying them to the mirror data within Fabric.
|
|
47
|
+
|
|
48
|
+
Policy Weaver will initially supports the following sources:
|
|
49
|
+
- [Databricks Unity Catalog]()
|
|
50
|
+
- BigQuery
|
|
51
|
+
- Snowflake
|
|
52
|
+
|
|
53
|
+
<mark><b>Note:</b>Policy Weaver is limited to read-only policies. Support for row filter and column-masking policies will be added in a future version.</mark>
|
|
54
|
+
|
|
55
|
+
This project is made available as a Python library and can be run from anywhere with a Python runtime.
|
|
56
|
+
|
|
57
|
+
For more information on getting started, please see the [Getting Started]() documentation.
|
|
58
|
+
|
|
59
|
+
## OneLake Data Access Roles Overview
|
|
60
|
+
|
|
61
|
+
Policy Weaver uses OneLake Data Access Roles to coalesce source system security policies into access policies that apply uniformly across the Fabric platform. With Data Access Roles, security policies are defined as role-based access controls (RBAC) on the data stored in OneLake.
|
|
62
|
+
|
|
63
|
+
When data is accessed from anywhere within Fabric, the defined RBAC policies are enforced. This means that data whether is accessed from a Notebook, SQL Endpoint or Semantic model the security policies defined by the source system are enforced consistently as expected.
|
|
64
|
+
|
|
65
|
+
For more details on OneLake Data Access policies, please see official Microsoft documentation: [OneLake Security Overview](https://learn.microsoft.com/en-us/fabric/onelake/security/get-started-security)
|
|
66
|
+
|
|
67
|
+
## Contributing
|
|
68
|
+
|
|
69
|
+
This project welcomes contributions and suggestions. Most contributions require you to agree to a
|
|
70
|
+
Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us
|
|
71
|
+
the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
|
|
72
|
+
|
|
73
|
+
When you submit a pull request, a CLA bot will automatically determine whether you need to provide
|
|
74
|
+
a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions
|
|
75
|
+
provided by the bot. You will only need to do this once across all repos using our CLA.
|
|
76
|
+
|
|
77
|
+
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
|
|
78
|
+
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or
|
|
79
|
+
contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
|
|
80
|
+
|
|
81
|
+
## Trademarks
|
|
82
|
+
|
|
83
|
+
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
|
|
84
|
+
trademarks or logos is subject to and must follow
|
|
85
|
+
[Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
|
|
86
|
+
Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
|
|
87
|
+
Any use of third-party trademarks or logos are subject to those third-party's policies.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
policy_weaver.egg-info/PKG-INFO
|
|
5
|
+
policy_weaver.egg-info/SOURCES.txt
|
|
6
|
+
policy_weaver.egg-info/dependency_links.txt
|
|
7
|
+
policy_weaver.egg-info/requires.txt
|
|
8
|
+
policy_weaver.egg-info/top_level.txt
|
|
9
|
+
policyweaver/__init__.py
|
|
10
|
+
policyweaver/policyweaver.py
|
|
11
|
+
policyweaver/weavercore.py
|
|
12
|
+
policyweaver/models/__init__.py
|
|
13
|
+
policyweaver/models/common.py
|
|
14
|
+
policyweaver/models/databricksmodel.py
|
|
15
|
+
policyweaver/models/fabricmodel.py
|
|
16
|
+
policyweaver/sources/__init__.py
|
|
17
|
+
policyweaver/sources/databricksclient.py
|
|
18
|
+
policyweaver/support/__init__.py
|
|
19
|
+
policyweaver/support/fabricapiclient.py
|
|
20
|
+
policyweaver/support/microsoftgraphclient.py
|
|
21
|
+
policyweaver/support/restapiclient.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
policyweaver
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
from typing import Optional, List, Any
|
|
2
|
+
from enum import Enum
|
|
3
|
+
from pydantic import BaseModel, Field, ConfigDict
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class CommonBaseModel(BaseModel):
|
|
7
|
+
model_config = ConfigDict(
|
|
8
|
+
populate_by_name=True,
|
|
9
|
+
use_enum_values=True,
|
|
10
|
+
arbitrary_types_allowed=True,
|
|
11
|
+
exclude_unset=True,
|
|
12
|
+
exclude_none=True,
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
def model_dump(self, **kwargs) -> dict[str, Any]:
|
|
16
|
+
return super().model_dump(by_alias=True, **kwargs)
|
|
17
|
+
|
|
18
|
+
def model_dump_json(self, **kwargs) -> dict[str, Any]:
|
|
19
|
+
return super().model_dump_json(by_alias=True, **kwargs)
|
|
20
|
+
|
|
21
|
+
def __getattr__(self, item):
|
|
22
|
+
for field, meta in self.model_fields.items():
|
|
23
|
+
if meta.alias == item:
|
|
24
|
+
return getattr(self, field)
|
|
25
|
+
return super().__getattr__(item)
|
|
26
|
+
|
|
27
|
+
def _get_alias(self, item_name):
|
|
28
|
+
for field, meta in self.model_fields.items():
|
|
29
|
+
if field == item_name:
|
|
30
|
+
return meta.alias
|
|
31
|
+
|
|
32
|
+
return None
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class CommonBaseEnum(Enum):
|
|
36
|
+
def __str__(self):
|
|
37
|
+
return str(self.value)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class IamType(str, CommonBaseEnum):
|
|
41
|
+
USER = "USER"
|
|
42
|
+
GROUP = "GROUP"
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
class PermissionType(str, CommonBaseEnum):
|
|
46
|
+
SELECT = "SELECT"
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
class PermissionState(str, CommonBaseEnum):
|
|
50
|
+
GRANT = "GRANT"
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class PolicyWeaverConnectorType(str, CommonBaseEnum):
|
|
54
|
+
UNITY_CATALOG = "UNITY_CATALOG"
|
|
55
|
+
SNOWFLAKE = "SNOWFLAKE"
|
|
56
|
+
BIGQUERY = "BIGQUERY"
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
class SourceSchema(CommonBaseModel):
|
|
60
|
+
name: Optional[str] = Field(alias="name", default=None)
|
|
61
|
+
tables: Optional[List[str]] = Field(alias="tables", default=None)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class CatalogItem(CommonBaseModel):
|
|
65
|
+
catalog: Optional[str] = Field(alias="catalog", default=None)
|
|
66
|
+
catalog_schema: Optional[str] = Field(alias="catalog_schema", default=None)
|
|
67
|
+
table: Optional[str] = Field(alias="table", default=None)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class Source(CommonBaseModel):
|
|
71
|
+
name: Optional[str] = Field(alias="name", default=None)
|
|
72
|
+
schemas: Optional[List[SourceSchema]] = Field(alias="schemas", default=None)
|
|
73
|
+
|
|
74
|
+
def get_schema_list(self) -> List[str]:
|
|
75
|
+
if not self.schemas:
|
|
76
|
+
return None
|
|
77
|
+
|
|
78
|
+
return [s.name for s in self.schemas]
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
class PermissionObject(CommonBaseModel):
|
|
82
|
+
id: Optional[str] = Field(alias="id", default=None)
|
|
83
|
+
type: Optional[IamType] = Field(alias="type", default=None)
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class Permission(CommonBaseModel):
|
|
87
|
+
name: Optional[str] = Field(alias="name", default=None)
|
|
88
|
+
state: Optional[str] = Field(alias="state", default=None)
|
|
89
|
+
objects: Optional[List[PermissionObject]] = Field(alias="objects", default=None)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
class Policy(CatalogItem):
|
|
93
|
+
permissions: Optional[List[Permission]] = Field(alias="permissions", default=None)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class PolicyExport(CommonBaseModel):
|
|
97
|
+
source: Optional[Source] = Field(alias="source", default=None)
|
|
98
|
+
type: Optional[PolicyWeaverConnectorType] = Field(alias="type", default=None)
|
|
99
|
+
policies: Optional[List[Policy]] = Field(alias="policies", default=None)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class FabricConfig(CommonBaseModel):
|
|
103
|
+
api_token: Optional[str] = Field(alias="api_token", default=None)
|
|
104
|
+
workspace_id: Optional[str] = Field(alias="workspace_id", default=None)
|
|
105
|
+
workspace_name: Optional[str] = Field(alias="workspace_name", default=None)
|
|
106
|
+
lakehouse_id: Optional[str] = Field(alias="lakehouse_id", default=None)
|
|
107
|
+
lakehouse_name: Optional[str] = Field(alias="lakehouse_name", default=None)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class ServicePrincipalConfig(CommonBaseModel):
|
|
111
|
+
tenant_id: Optional[str] = Field(alias="tenant_id", default=None)
|
|
112
|
+
client_id: Optional[str] = Field(alias="client_id", default=None)
|
|
113
|
+
client_secret: Optional[str] = Field(alias="client_secret", default=None)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
class SourceMapItem(CatalogItem):
|
|
117
|
+
lakehouse_table_name: Optional[str] = Field(
|
|
118
|
+
alias="lakehouse_table_name", default=None
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
class SourceMap(CommonBaseModel):
|
|
123
|
+
type: Optional[PolicyWeaverConnectorType] = Field(alias="type", default=None)
|
|
124
|
+
source: Optional[Source] = Field(alias="source", default=None)
|
|
125
|
+
fabric: Optional[FabricConfig] = Field(alias="fabric", default=None)
|
|
126
|
+
service_principal: Optional[ServicePrincipalConfig] = Field(
|
|
127
|
+
alias="service_principal", default=None
|
|
128
|
+
)
|
|
129
|
+
mapped_items: Optional[List[SourceMapItem]] = Field(
|
|
130
|
+
alias="mapped_items", default=None
|
|
131
|
+
)
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
from policyweaver.models.common import (
|
|
2
|
+
CommonBaseModel,
|
|
3
|
+
IamType,
|
|
4
|
+
SourceMap
|
|
5
|
+
)
|
|
6
|
+
from pydantic import Field
|
|
7
|
+
from typing import Optional, List
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Privilege(CommonBaseModel):
|
|
11
|
+
principal: Optional[str] = Field(alias="principal", default=None)
|
|
12
|
+
privileges: Optional[List[str]] = Field(alias="privileges", default=None)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class BaseObject(CommonBaseModel):
|
|
16
|
+
id: Optional[str] = Field(alias="id", default=None)
|
|
17
|
+
name: Optional[str] = Field(alias="name", default=None)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class PrivilegedObject(BaseObject):
|
|
21
|
+
privileges: Optional[List[Privilege]] = Field(alias="privileges", default=None)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class FunctionMap(BaseObject):
|
|
25
|
+
columns: Optional[List[str]] = Field(alias="column", default=None)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Function(PrivilegedObject):
|
|
29
|
+
sql: Optional[str] = Field(alias="sql", default=None)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class Table(PrivilegedObject):
|
|
33
|
+
column_masks: Optional[List[FunctionMap]] = Field(
|
|
34
|
+
alias="column_masks", default=None
|
|
35
|
+
)
|
|
36
|
+
row_filter: Optional[FunctionMap] = Field(alias="row_filter", default=None)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class Schema(PrivilegedObject):
|
|
40
|
+
tables: Optional[List[Table]] = Field(alias="table", default=None)
|
|
41
|
+
mask_functions: Optional[List[Function]] = Field(
|
|
42
|
+
alias="mask_functions", default=None
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class Catalog(PrivilegedObject):
|
|
47
|
+
schemas: Optional[List[Schema]] = Field(alias="schemas", default=None)
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
class WorkspaceUser(BaseObject):
|
|
51
|
+
email: Optional[str] = Field(alias="email", default=None)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
class WorkspaceGroupMember(BaseObject):
|
|
55
|
+
type: Optional[IamType] = Field(alias="type", default=None)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class WorkspaceGroup(BaseObject):
|
|
59
|
+
members: Optional[List[WorkspaceGroupMember]] = Field(alias="members", default=None)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class Workspace(BaseObject):
|
|
63
|
+
catalog: Optional[Catalog] = Field(alias="catalog", default=None)
|
|
64
|
+
users: Optional[List[WorkspaceUser]] = Field(alias="users", default=None)
|
|
65
|
+
groups: Optional[List[WorkspaceGroup]] = Field(alias="groups", default=None)
|
|
66
|
+
|
|
67
|
+
class DatabricksWorkspace(CommonBaseModel):
|
|
68
|
+
workspace: Optional[Workspace] = Field(alias="workspace", default=None)
|
|
69
|
+
api_token: Optional[str] = Field(alias="api_token", default=None)
|
|
70
|
+
|
|
71
|
+
class DatabricksSourceMap(SourceMap):
|
|
72
|
+
databricks: Optional[DatabricksWorkspace] = Field(alias="databricks", default=None)
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
from policyweaver.models.common import CommonBaseModel, CommonBaseEnum
|
|
2
|
+
from typing import List, Optional
|
|
3
|
+
from pydantic import Field
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class FabricPolicyAccessType(str, CommonBaseEnum):
|
|
7
|
+
EXECUTE = "Execute"
|
|
8
|
+
EXPLORE = "Explore"
|
|
9
|
+
READ = "Read"
|
|
10
|
+
READ_ALL = "ReadAll"
|
|
11
|
+
RESHARE = "Reshare"
|
|
12
|
+
WRITE = "Write"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class FabricMemberObjectType(str, CommonBaseEnum):
|
|
16
|
+
GROUP = "Group"
|
|
17
|
+
MANAGED_IDENTITY = "ManagedIdentity"
|
|
18
|
+
SERVICE_PRINCIPAL = "ServicePrincipal"
|
|
19
|
+
USER = "User"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
class PolicyEffectType(str, CommonBaseEnum):
|
|
23
|
+
PERMIT = "Permit"
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
class PolicyAttributeType(str, CommonBaseEnum):
|
|
27
|
+
ACTION = "Action"
|
|
28
|
+
PATH = "Path"
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class EntraMember(CommonBaseModel):
|
|
32
|
+
object_id: Optional[str] = Field(alias="objectId", default=None)
|
|
33
|
+
object_type: Optional[FabricMemberObjectType] = Field(
|
|
34
|
+
alias="objectType", default=None
|
|
35
|
+
)
|
|
36
|
+
tenant_id: Optional[str] = Field(alias="tenantId", default=None)
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class PolicyMember(CommonBaseModel):
|
|
40
|
+
source_path: Optional[str] = Field(alias="sourcePath", default=None)
|
|
41
|
+
item_access: Optional[List[FabricPolicyAccessType]] = Field(
|
|
42
|
+
alias="itemAccess", default=None
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class PolicyMembers(CommonBaseModel):
|
|
47
|
+
fabric_members: Optional[List[PolicyMember]] = Field(
|
|
48
|
+
alias="fabricItemMembers", default=None
|
|
49
|
+
)
|
|
50
|
+
entra_members: Optional[List[EntraMember]] = Field(
|
|
51
|
+
alias="microsoftEntraMembers", default=None
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
class PolicyPermissionScope(CommonBaseModel):
|
|
56
|
+
attribute_name: Optional[PolicyAttributeType] = Field(
|
|
57
|
+
alias="attributeName", default=None
|
|
58
|
+
)
|
|
59
|
+
attribute_value_included_in: Optional[List[str]] = Field(
|
|
60
|
+
alias="attributeValueIncludedIn", default=None
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
class PolicyDecisionRule(CommonBaseModel):
|
|
65
|
+
effect: Optional[PolicyEffectType] = Field(alias="effect", default=None)
|
|
66
|
+
permission: Optional[List[PolicyPermissionScope]] = Field(
|
|
67
|
+
alias="permission", default=None
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
class DataAccessPolicy(CommonBaseModel):
|
|
72
|
+
id: Optional[str] = Field(alias="id", default=None)
|
|
73
|
+
name: Optional[str] = Field(alias="name", default=None)
|
|
74
|
+
decision_rules: Optional[List[PolicyDecisionRule]] = Field(
|
|
75
|
+
alias="decisionRules", default=None
|
|
76
|
+
)
|
|
77
|
+
members: Optional[PolicyMembers] = Field(alias="members", default=None)
|