Skip to content

Commit

Permalink
feat: add more request
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksey Kuznetsov committed Jan 21, 2025
1 parent 4ea31f1 commit 1a4bb74
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions src/keycloak/keycloak_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8880,3 +8880,33 @@ async def a_clear_user_cache(self):
urls_patterns.URL_ADMIN_CLEAR_USER_CACHE.format(**params_path), data=""
)
return raise_error_from_response(data_raw, KeycloakPostError, expected_codes=[204])

async def a_change_execution_priority(self, execution_id, diff):
"""Raise or lower execution priority of diff time asynchronously.
:param execution_id: id of execution to lower priority
:type execution_id: str
:param diff: Integer number, raise of diff time if positive lower of diff time if negative
:type diff: int
:raises KeycloakPostError: when post requests are failed
"""
params_path = {"id": execution_id, "realm-name": self.connection.realm_name}
try:
if diff > 0:
for i in range(diff):
_ = self.connection.a_raw_post(
urls_patterns.URL_AUTHENTICATION_EXECUTION_RAISE_PRIORITY.format(
**params_path
),
data="{}",
)
elif diff < 0:
for i in range(-diff):
_ = self.connection.a_raw_post(
urls_patterns.URL_AUTHENTICATION_EXECUTION_LOWER_PRIORITY.format(
**params_path
),
data="{}",
)
except Exception as e:
raise KeycloakPostError(f"Unable to change execution priority {execution_id}") from e

0 comments on commit 1a4bb74

Please sign in to comment.