A plugin interface for authorization calls, allowing or disallowing operations in OpenTSDB. @since 2.4
| 28 | * @since 2.4 |
| 29 | */ |
| 30 | public interface Authorization { |
| 31 | |
| 32 | /** |
| 33 | * Called by TSDB to initialize the plugin |
| 34 | * Implementations are responsible for setting up any IO they need as well |
| 35 | * as starting any required background threads. |
| 36 | * <b>Note:</b> Implementations should throw exceptions if they can't start |
| 37 | * up properly. The TSD will then shutdown so the operator can fix the |
| 38 | * problem. Please use IllegalArgumentException for configuration issues. |
| 39 | * @param tsdb The parent TSDB object |
| 40 | * @throws IllegalArgumentException if required configuration parameters are |
| 41 | * missing |
| 42 | * @throws RuntimeException if something else goes wrong |
| 43 | */ |
| 44 | public abstract void initialize(final TSDB tsdb); |
| 45 | |
| 46 | /** |
| 47 | * Called to gracefully shutdown the plugin. Implementations should close |
| 48 | * any IO they have open |
| 49 | * @return A deferred object that indicates the completion of the request. |
| 50 | * The {@link Object} has not special meaning and can be {@code null} |
| 51 | * (think of it as {@code Deferred<Void>}). |
| 52 | */ |
| 53 | public abstract Deferred<Object> shutdown(); |
| 54 | |
| 55 | /** |
| 56 | * Should return the version of this plugin in the format: |
| 57 | * MAJOR.MINOR.MAINT, e.g. 2.0.1. The MAJOR version should match the major |
| 58 | * version of OpenTSDB the plugin is meant to work with. |
| 59 | * @return A version string used to log the loaded version |
| 60 | */ |
| 61 | public abstract String version(); |
| 62 | |
| 63 | /** |
| 64 | * Called by the TSD when a request for statistics collection has come in. The |
| 65 | * implementation may provide one or more statistics. If no statistics are |
| 66 | * available for the implementation, simply stub the method. |
| 67 | * @param collector The collector used for emitting statistics |
| 68 | */ |
| 69 | public abstract void collectStats(final StatsCollector collector); |
| 70 | |
| 71 | /** |
| 72 | * Determines if the user has a specified permission |
| 73 | * @param state |
| 74 | * @param permission |
| 75 | * @return |
| 76 | */ |
| 77 | public abstract AuthState hasPermission(final AuthState state, final Permissions permission); |
| 78 | |
| 79 | /** |
| 80 | * Determines if the user is allowed to execute the given query. |
| 81 | * The returned state contains a status code regarding whether or not the query |
| 82 | * is allowed. If the query IS allowed, the same user state passed as an |
| 83 | * argument maybe returned. |
| 84 | * @param state A non-null auth state with the user and AuthStatus.SUCCESS. |
| 85 | * @param query A non-null query. |
| 86 | * @return An AuthState object with a valid AuthStatus to evaluate for |
| 87 | * permission. |
no outgoing calls
no test coverage detected
searching dependent graphs…