Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

medic: print policies as tables #880

Merged
merged 1 commit into from
Sep 7, 2023
Merged

medic: print policies as tables #880

merged 1 commit into from
Sep 7, 2023

Conversation

JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Sep 7, 2023

This allows for printing policy definitions with a table output. This is meant to be
a little friendlier than the straight YAML output we used to give.

Note that this also removes the status flag from the policy get command, as we're leaning towards more simple commands and this just duplicates the functionality from the policy_status get command.

Sample:

$ medic policy get -i 1 -p github
+----+--------------------+----------+------------+---------+------------------------------+--------------+-----------------------------------------+
| ID |        NAME        | PROVIDER |   ENTITY   | CONTEXT |          RULE                | RULE PARAMS  |             RULE DEFINITION             |
+----+--------------------+----------+------------+---------+------------------------------+--------------+-----------------------------------------+
|  1 | acme-github-policy | github   | repository | github  | secret_scanning              |              | enabled: true                           |
|    |                    |          |            |         |                              |              |                                         |
+    +                    +          +            +         +------------------------------+--------------+-----------------------------------------+
|    |                    |          |            |         | secret_push_protection       |              | enabled: true                           |
|    |                    |          |            |         |                              |              |                                         |
+    +                    +          +            +         +------------------------------+--------------+-----------------------------------------+
|    |                    |          |            |         | branch_protection            | branch: main | allow_deletions: false                  |
|    |                    |          |            |         |                              |              | allow_force_pushes: false               |
|    |                    |          |            |         |                              |              | allow_fork_syncing: true                |
|    |                    |          |            |         |                              |              | required_linear_history: true           |
|    |                    |          |            |         |                              |              | required_pull_request_reviews:          |
|    |                    |          |            |         |                              |              |   dismiss_stale_reviews: true           |
|    |                    |          |            |         |                              |              |   require_code_owner_reviews: true      |
|    |                    |          |            |         |                              |              |   required_approving_review_count: 1    |
|    |                    |          |            |         |                              |              |                                         |
+    +                    +          +            +         +------------------------------+--------------+-----------------------------------------+
|    |                    |          |            |         | github_actions_allowed       |              | allowed_actions: selected               |
|    |                    |          |            |         |                              |              |                                         |
+    +                    +          +            +         +------------------------------+--------------+-----------------------------------------+
|    |                    |          |            |         | allowed_selected_actions     |              | github_owned_allowed: true              |
|    |                    |          |            |         |                              |              | patterns_allowed: []                    |
|    |                    |          |            |         |                              |              | verified_allowed: true                  |
|    |                    |          |            |         |                              |              |                                         |
+    +                    +          +            +         +------------------------------+--------------+-----------------------------------------+
|    |                    |          |            |         | default_workflow_permissions |              | can_approve_pull_request_reviews: false |
|    |                    |          |            |         |                              |              | default_workflow_permissions: read      |
|    |                    |          |            |         |                              |              |                                         |
+    +                    +          +            +         +------------------------------+--------------+-----------------------------------------+
|    |                    |          |            |         | codeql_enabled               |              | {}                                      |
|    |                    |          |            |         |                              |              |                                         |
+    +                    +          +            +         +------------------------------+--------------+-----------------------------------------+
|    |                    |          |            |         | actions_check_pinned_tags    |              | {}                                      |
|    |                    |          |            |         |                              |              |                                         |
+    +                    +          +            +         +------------------------------+--------------+-----------------------------------------+
|    |                    |          |            |         | dependabot_enabled           |              | {}                                      |
|    |                    |          |            |         |                              |              |                                         |
+    +                    +          +------------+         +------------------------------+--------------+-----------------------------------------+
|    |                    |          | artifact   |         | artifact_signature           | name: test   | is_bundle_verified: true                |
|    |                    |          |            |         |                              | tags:        | is_signed: true                         |
|    |                    |          |            |         |                              | - main       | is_verified: true                       |
|    |                    |          |            |         |                              |              |                                         |
+----+--------------------+----------+------------+---------+------------------------------+--------------+-----------------------------------------+

Related to #876

This allows for printing policy definitions with a table output. This is meant to be
a little friendlier than the straight YAML output we used to give.
@JAORMX JAORMX merged commit 306ea60 into main Sep 7, 2023
12 checks passed
@JAORMX JAORMX deleted the table-policy branch September 7, 2023 09:07
@JAORMX JAORMX restored the table-policy branch September 7, 2023 12:39
@JAORMX JAORMX deleted the table-policy branch September 19, 2023 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants