fix: updated to match new caor endpoint structure
This commit is contained in:
parent
05bd63c33e
commit
5c5cb137fc
1 changed files with 12 additions and 7 deletions
|
|
@ -18,7 +18,7 @@ Exports:
|
||||||
- Verify module level docstring is still accurate after updates
|
- Verify module level docstring is still accurate after updates
|
||||||
"""
|
"""
|
||||||
import threading
|
import threading
|
||||||
from typing import Annotated
|
from typing import Annotated, Optional
|
||||||
|
|
||||||
from fastapi import APIRouter, Request, HTTPException
|
from fastapi import APIRouter, Request, HTTPException
|
||||||
from fastapi.params import Query
|
from fastapi.params import Query
|
||||||
|
|
@ -31,6 +31,7 @@ router = APIRouter(
|
||||||
tags=[""],
|
tags=[""],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@router.put("/timer/start")
|
@router.put("/timer/start")
|
||||||
async def start_timer(request: Request, interval: int):
|
async def start_timer(request: Request, interval: int):
|
||||||
def example_timer_target():
|
def example_timer_target():
|
||||||
|
|
@ -71,16 +72,20 @@ async def stop_timer(request: Request, ident: str):
|
||||||
|
|
||||||
|
|
||||||
@router.get("/hub/access")
|
@router.get("/hub/access")
|
||||||
async def test_hub_access(headers: header_dependency, client: http_client_dependency, org_name: Annotated[str, Query()]):
|
async def test_hub_access(headers: header_dependency, client: http_client_dependency, org_name: Annotated[str, Query()],
|
||||||
resource_name = "example_resource"
|
resource_name: Annotated[str, Query()] = "example_resource",
|
||||||
action = "read"
|
action: Annotated[str, Query()] = "read", instance: Optional[Annotated[str, Query()]] = None):
|
||||||
rn = generate_resource_name(resource=resource_name, org=org_name)
|
rn = generate_resource_name(resource=resource_name, org=org_name, instance=instance)
|
||||||
|
|
||||||
|
request_body = {
|
||||||
|
"rn": rn.model_dump(),
|
||||||
|
"action": action,
|
||||||
|
}
|
||||||
|
|
||||||
hub_response = await client.post(
|
hub_response = await client.post(
|
||||||
f"http://localhost:8001/api/v1/iam/can_act_on_resource",
|
f"http://localhost:8001/api/v1/iam/can_act_on_resource",
|
||||||
headers=headers,
|
headers=headers,
|
||||||
params={"action": action},
|
json=request_body
|
||||||
json=rn.model_dump()
|
|
||||||
)
|
)
|
||||||
|
|
||||||
response = {
|
response = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue