ApiManagementConsoleV2.RoutePolicies (api_management_console v0.1.0)

Copy Markdown View Source

Route policy management for enabling/disabling endpoints.

Backed by DETS for persistence. Routes are keyed as "method|path" (e.g. "get|/api/users"). Some routes are immutable (protected) and cannot be toggled — configured via :api_management_console, :protected_routes.

Supports string prefixes/suffixes and regex patterns (matched against path and controller):

config :api_management_console,
  protected_routes: ["/dev/dashboard", ~r{HealthController}]

Summary

Functions

Returns a specification to start this module under a supervisor.

Check if a path belongs to the API console itself.

Check if a route is enabled by key.

Returns all routes as a flat list.

Returns routes grouped by namespace, with enabled state and mutable flag.

Check if a request (method + path) is allowed.

Reset all policies — delete DETS file.

Toggle all mutable routes in a group. Returns [{key, old_state}].

Toggle a single route by key. Returns the old state.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

console_route?(path)

Check if a path belongs to the API console itself.

enabled?(key)

Check if a route is enabled by key.

list_all_routes(router)

Returns all routes as a flat list.

list_grouped_routes(router)

Returns routes grouped by namespace, with enabled state and mutable flag.

request_allowed?(router, method, path)

Check if a request (method + path) is allowed.

reset_all()

Reset all policies — delete DETS file.

set_group_enabled(router, group, enabled)

Toggle all mutable routes in a group. Returns [{key, old_state}].

set_route_enabled(route_key, enabled)

Toggle a single route by key. Returns the old state.