-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from authorizon/policy_fetcher_handle_errors
policy fetcher can handle error response codes
- Loading branch information
Showing
6 changed files
with
96 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,15 @@ | ||
from fastapi import APIRouter, status | ||
from starlette.status import HTTP_200_OK | ||
|
||
from opal_common.logger import logger | ||
from opal_client.policy.updater import update_policy | ||
from opal_client.policy_store import BasePolicyStoreClient, DEFAULT_POLICY_STORE_GETTER | ||
from opal_client.policy.updater import PolicyUpdater | ||
|
||
def init_policy_router(policy_store:BasePolicyStoreClient=None): | ||
policy_store = policy_store or DEFAULT_POLICY_STORE_GETTER() | ||
def init_policy_router(policy_updater: PolicyUpdater): | ||
router = APIRouter() | ||
|
||
@router.post("/policy-updater/trigger", status_code=status.HTTP_200_OK) | ||
async def trigger_policy_update(): | ||
logger.info("triggered policy update from api") | ||
await update_policy(policy_store) | ||
await policy_updater.update_policy(force_full_update=True) | ||
return {"status": "ok"} | ||
|
||
return router |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters