vincbeck commented on code in PR #59134:
URL: https://github.com/apache/airflow/pull/59134#discussion_r2598942038
##########
providers/keycloak/src/airflow/providers/keycloak/auth_manager/cli/commands.py:
##########
@@ -112,41 +117,97 @@ def _get_client_uuid(args):
return matches[0]["id"]
-def _create_scopes(client: KeycloakAdmin, client_uuid: str):
+def _get_scopes_to_create() -> list[dict]:
+ """Get the list of scopes to be created."""
scopes = [{"name": method} for method in get_args(ResourceMethod)]
scopes.extend([{"name": "MENU"}, {"name": "LIST"}])
+ return scopes
+
+
+def _preview_scopes(client: KeycloakAdmin, client_uuid: str, **kwargs):
+ """Preview scopes that would be created."""
+ scopes = _get_scopes_to_create()
+ print("Scopes to be created:")
+ for scope in scopes:
+ print(f" - {scope['name']}")
+ print()
+
+
+@dry_run_preview(_preview_scopes)
+def _create_scopes(client: KeycloakAdmin, client_uuid: str, **kwargs):
Review Comment:
Do you need `kwargs`?
##########
providers/keycloak/src/airflow/providers/keycloak/auth_manager/cli/commands.py:
##########
@@ -112,41 +117,97 @@ def _get_client_uuid(args):
return matches[0]["id"]
-def _create_scopes(client: KeycloakAdmin, client_uuid: str):
+def _get_scopes_to_create() -> list[dict]:
+ """Get the list of scopes to be created."""
scopes = [{"name": method} for method in get_args(ResourceMethod)]
scopes.extend([{"name": "MENU"}, {"name": "LIST"}])
+ return scopes
+
+
+def _preview_scopes(client: KeycloakAdmin, client_uuid: str, **kwargs):
Review Comment:
You do not seem to need parameter?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]