A DSL for generating rules.json files for Trino
Project description
osc-trino-acl-dsl
A declarative format for configuring Trino access control
To operationalize this code you need Trino adminstrator privileges
examples:
Converting Trino ACL DSL to a rules.json
# install package using pipenv, pip or similar tools
$ pipenv install osc-trino-acl-dsl
# the package command `trino-dsl-to-rules` will load the given yaml or json file
# and write the resulting 'rules.json' file to standard output
# dsl-example-1.yaml is in the 'examples' directory of this repository
$ pipenv run trino-dsl-to-rules dsl-example-1.yaml > rules.json
# rules.json is trino file-based access control rules file
$ head rules.json
{
"catalogs": [
{
"group": "admins",
"allow": "all"
},
{
"group": ".*",
"catalog": "dev",
"allow": "all"
Using pre-commit checks
For more information on pre-commit checks, see here
Here is an example entry for .pre-commit-config.yaml
For more info see here
repos:
- repo: https://github.com/os-climate/osc-trino-acl-dsl
rev: v0.3.0
hooks:
# a pre-commit check to verify that an ACL DSL yaml file is in sync with rules.json file
- id: trino-acl-dsl-check
building and testing
iterative dev/test for pre-commit checks
- check out this repository
- make some change to precommit checks you want to test
- in a test repository, make an edit you expect your precommit check to operate on, then
git add
this edit (i.e. stage it for commit) but do NOT commit it, so the precommit check sees it and properly provides staged files to the argument list. - run
pre-commit try-repo /path/to/osc-trino-acl-dsl --verbose
(see here) - examine the output of your precommit check to see if it did what you want
publish new version to pypi
- update all occurrences of
__version__
(trygit grep version
) python3 setup.py clean
orgit clean -fdx
python3 setup.py sdist
twine check dist/*
twine upload dist/*
- push latest to repo
- create new release tag on github
upload test or release candidate:
- twine upload --repository-url https://test.pypi.org/legacy/ dist/*
python packaging resources
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
osc-trino-acl-dsl-0.3.0.tar.gz
(14.2 kB
view details)
Built Distribution
File details
Details for the file osc-trino-acl-dsl-0.3.0.tar.gz
.
File metadata
- Download URL: osc-trino-acl-dsl-0.3.0.tar.gz
- Upload date:
- Size: 14.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ece1952845bf60e2f13f1036550aae0452ba2ebb4e61b0acfb4e775521a5e44a |
|
MD5 | bc3971fdb246e8072614e109154e89b1 |
|
BLAKE2b-256 | 0a4375356aa73645a5b85ae880382770e304352499a16e5c58dbafa18358afc4 |
File details
Details for the file osc_trino_acl_dsl-0.3.0-py3-none-any.whl
.
File metadata
- Download URL: osc_trino_acl_dsl-0.3.0-py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.8.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddff2e15655874d5e85dffcd84273f9c964340ff99fec587f5e56cf7bdde13da |
|
MD5 | 143ec4b867307ba9f3d262047f390958 |
|
BLAKE2b-256 | 025a4cafd01eab240937ed14ae70e76d43a37c8594834fa68d50e4af3232061f |