ecodina commented on code in PR #59134:
URL: https://github.com/apache/airflow/pull/59134#discussion_r2599703482


##########
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:
   I had it like this so mypy doesn't complain. The decorator "eats" the 
`dry_run` parameter so the function doesn't actually need it in the signature. 
To improve readability, I'll change it to:
   
   `def _create_scopes(client: KeycloakAdmin, client_uuid: str, *, _dry_run: 
bool = False)`



-- 
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]

Reply via email to