@@ -50,42 +50,48 @@ var (
5050// PUBLIC METHODS - ENDPOINTS
5151
5252// Add endpoints to the router
53- func (service * nginx ) AddEndpoints (ctx context.Context , router server.Router ) {
53+ func (service * nginx ) AddEndpoints (ctx context.Context , r server.Router ) {
5454 // Path: /
5555 // Methods: GET
56- // Scopes: read // TODO: Add scopes
56+ // Scopes: read
5757 // Description: Get nginx status (version, uptime, available and enabled configurations)
58- router .AddHandlerFuncRe (ctx , reRoot , service .GetHealth , http .MethodGet )
58+ r .AddHandlerFuncRe (ctx , reRoot , service .GetHealth , http .MethodGet ).(router.Route ).
59+ SetScope (service .ScopeRead ()... )
5960
6061 // Path: /(test|reload|reopen)
6162 // Methods: PUT
62- // Scopes: write // TODO: Add scopes
63+ // Scopes: write
6364 // Description: Test, reload and reopen nginx configuration
64- router .AddHandlerFuncRe (ctx , reAction , service .PutAction , http .MethodPut )
65+ r .AddHandlerFuncRe (ctx , reAction , service .PutAction , http .MethodPut ).(router.Route ).
66+ SetScope (service .ScopeWrite ()... )
6567
6668 // Path: /config
6769 // Methods: GET
68- // Scopes: read // TODO: Add scopes
70+ // Scopes: read
6971 // Description: Read the current set of configurations
70- router .AddHandlerFuncRe (ctx , reListConfig , service .ListConfig , http .MethodGet )
72+ r .AddHandlerFuncRe (ctx , reListConfig , service .ListConfig , http .MethodGet ).(router.Route ).
73+ SetScope (service .ScopeRead ()... )
7174
7275 // Path: /config
7376 // Methods: POST
74- // Scopes: read // TODO: Add scopes
77+ // Scopes: write
7578 // Description: Create a new configuration
76- router .AddHandlerFuncRe (ctx , reListConfig , service .CreateConfig , http .MethodPost )
79+ r .AddHandlerFuncRe (ctx , reListConfig , service .CreateConfig , http .MethodPost ).(router.Route ).
80+ SetScope (service .ScopeWrite ()... )
7781
7882 // Path: /config/{id}
7983 // Methods: GET
80- // Scopes: read // TODO: Add scopes
84+ // Scopes: read
8185 // Description: Read a configuration
82- router .AddHandlerFuncRe (ctx , reConfig , service .ReadConfig , http .MethodGet )
86+ r .AddHandlerFuncRe (ctx , reConfig , service .ReadConfig , http .MethodGet ).(router.Route ).
87+ SetScope (service .ScopeRead ()... )
8388
8489 // Path: /config/{id}
8590 // Methods: DELETE, POST, PATCH
86- // Scopes: write // TODO: Add scopes
91+ // Scopes: write
8792 // Description: Modify a configuration
88- router .AddHandlerFuncRe (ctx , reConfig , service .WriteConfig , http .MethodDelete , http .MethodPatch )
93+ r .AddHandlerFuncRe (ctx , reConfig , service .WriteConfig , http .MethodDelete , http .MethodPatch ).(router.Route ).
94+ SetScope (service .ScopeWrite ()... )
8995}
9096
9197///////////////////////////////////////////////////////////////////////////////
0 commit comments