跳转到主要内容

为Trino生成rules.json文件的DSL

项目描述

osc-trino-acl-dsl

Trino访问控制的声明性格式

要使此代码投入运行,您需要Trino管理员权限

示例

将Trino ACL DSL转换为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"

使用pre-commit检查

有关pre-commit检查的更多信息,请参阅此处

以下是一个.pre-commit-config.yaml的示例条目。更多信息请参阅此处

repos:
  - repo: https://github.com/os-climate/osc-trino-acl-dsl
    rev: v0.3.1
    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

构建和测试

为pre-commit检查进行的迭代开发和测试

  1. 查看此存储库
  2. 对想要测试的precommit检查进行一些更改
  3. 在一个测试存储库中,对您期望precommit检查操作的编辑进行编辑,然后使用git add此编辑(即将其暂存以供提交),但不要提交它,这样precommit检查就可以看到它,并正确地提供暂存文件给参数列表。
  4. 运行pre-commit try-repo /path/to/osc-trino-acl-dsl --verbose(请参阅此处
  5. 检查您precommit检查的输出,以查看它是否按您希望的方式执行

发布新版本到PyPI

  • 更新所有__version__的实例(尝试使用git grep version
  • 运行python3 setup.py cleangit clean -fdx
  • python3 setup.py sdist
  • twine check dist/*
  • twine upload dist/*
  • 将最新版本推送到存储库
  • 在GitHub上创建新的发布标签

上传测试版或候选发布版

Python打包资源

项目详情


下载文件

下载适合您平台的文件。如果您不确定该选择哪一个,请了解更多关于安装包的信息。

源代码分发

osc-trino-acl-dsl-0.3.1.tar.gz (14.6 kB 查看哈希值)

上传时间 源代码

构建分发

osc_trino_acl_dsl-0.3.1-py3-none-any.whl (14.5 kB 查看哈希值)

上传时间 Python 3

由以下组织支持