o-nikolas commented on code in PR #51691: URL: https://github.com/apache/airflow/pull/51691#discussion_r2150943345
########## providers/keycloak/src/airflow/providers/keycloak/auth_manager/cli/commands.py: ########## @@ -0,0 +1,224 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +from __future__ import annotations + +import json +import logging +from typing import get_args + +from keycloak import KeycloakAdmin, KeycloakError + +from airflow.api_fastapi.auth.managers.base_auth_manager import ResourceMethod +from airflow.configuration import conf +from airflow.providers.keycloak.auth_manager.constants import ( + CONF_CLIENT_ID_KEY, + CONF_REALM_KEY, + CONF_SECTION_NAME, + CONF_SERVER_URL_KEY, +) +from airflow.providers.keycloak.auth_manager.resources import KeycloakResource +from airflow.utils import cli as cli_utils +from airflow.utils.providers_configuration_loader import providers_configuration_loaded + +log = logging.getLogger(__name__) + + +@cli_utils.action_cli +@providers_configuration_loaded +def create_scopes_command(args): + """Create Keycloak auth manager scopes in Keycloak.""" + client = _get_client(args) + client_uuid = _get_client_uuid(args) + + _create_scopes(client, client_uuid) + + +@cli_utils.action_cli +@providers_configuration_loaded +def create_resources_command(args): + """Create Keycloak auth manager resources in Keycloak.""" + client = _get_client(args) + client_uuid = _get_client_uuid(args) + + _create_resources(client, client_uuid) + + +@cli_utils.action_cli +@providers_configuration_loaded +def create_permissions_command(args): + """Create Keycloak auth manager permissions in Keycloak.""" + client = _get_client(args) + client_uuid = _get_client_uuid(args) + + _create_permissions(client, client_uuid) + + +@cli_utils.action_cli +@providers_configuration_loaded +def create_all_command(args): + """Create Keycloak auth manager scopes in Keycloak.""" Review Comment: I know this is already merged but just catching up now that I'm back and spotted this copy/paste error -- 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]
