You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+50-2Lines changed: 50 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ To run locally:
39
39
40
40
If you run the development version the table and index will be created for you automatically.
41
41
42
-
#### IAM Permissions:
42
+
#### IAM Permissions
43
43
44
44
Repokid needs an IAM Role in each account that will be queried. Additionally, Repokid needs to be launched with a role or user which can `sts:AssumeRole` into the different account roles.
45
45
@@ -131,11 +131,15 @@ By default the age filter excludes roles that are younger than 90 days. To chan
131
131
`filter_config.AgeFilter.minimum_age`.
132
132
133
133
### Active Filters
134
+
134
135
New filters can be created to support internal logic. At Netflix we have several that are specific to our
135
136
use cases. To make them active make sure they are in the Python path and add them in the config to the list in
136
137
the section `active_filters`.
137
138
138
-
## Hooks
139
+
## Extending Repokid
140
+
141
+
### Hooks
142
+
139
143
Repokid is extensible via hooks that are called before, during, and after various operations as listed below.
140
144
141
145
| Hook name | Context |
@@ -147,8 +151,52 @@ Repokid is extensible via hooks that are called before, during, and after variou
"""Filters are initialized with a dict containing the contents of `filter_config.FilterName`
183
+
from the config file. This example would be initialized with `filter_config.CustomFilterName`.
184
+
The configuration can be accessed via `self.config`
185
+
186
+
If you don't need any custom initialization logic, you can leave this function out of your
187
+
filter class.
188
+
"""
189
+
super().__init__(config=config)
190
+
# custom initialization logic goes here
191
+
...
192
+
193
+
defapply(self, input_list: RoleList) -> RoleList:
194
+
"""Determine roles to be excluded and return them as a RoleList"""
195
+
...
196
+
```
197
+
198
+
A simple filter implementation can be found in [`repokid.filters.age`](repokid/filters/age/__init__.py). A more complex example is in [`repokid.blocklist.age`](repokid/filters/blocklist/__init__.py).
0 commit comments