bugraoz93 commented on code in PR #49496: URL: https://github.com/apache/airflow/pull/49496#discussion_r2067499128
########## airflow-ctl/src/airflowctl/ctl/commands/pool_command.py: ########## @@ -0,0 +1,112 @@ +# 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. +"""Command functions for managing Airflow pools.""" + +from __future__ import annotations + +import json +from json import JSONDecodeError +from pathlib import Path + +import rich + +from airflowctl.api.client import Client, ClientKind, provide_api_client +from airflowctl.api.datamodels.generated import ( + BulkAction, + BulkActionOnExistence, + BulkBodyPoolBody, + BulkCreateActionPoolBody, + PoolBody, +) + + +@provide_api_client(kind=ClientKind.CLI) +def import_(api_client: Client, file: str | Path, **kwargs): Review Comment: ```suggestion def import(args, api_client: Client = NEW_API_CLIENT): ``` `args` should contain those parameters like `args.file`. We can also delete kwargs. That is already there as a concept and we aren't using it. ########## airflow-ctl/src/airflowctl/ctl/cli_config.py: ########## @@ -548,6 +595,11 @@ def merge_commands( "Either pass token from environment variable/parameter or pass username and password.", subcommands=AUTH_COMMANDS, ), + GroupCommand( + name="pool", Review Comment: ```suggestion name="pools", ``` ########## airflow-ctl/src/airflowctl/ctl/commands/pool_command.py: ########## @@ -0,0 +1,112 @@ +# 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. +"""Command functions for managing Airflow pools.""" + +from __future__ import annotations + +import json +from json import JSONDecodeError +from pathlib import Path + +import rich + +from airflowctl.api.client import Client, ClientKind, provide_api_client +from airflowctl.api.datamodels.generated import ( + BulkAction, + BulkActionOnExistence, + BulkBodyPoolBody, + BulkCreateActionPoolBody, + PoolBody, +) + + +@provide_api_client(kind=ClientKind.CLI) +def import_(api_client: Client, file: str | Path, **kwargs): Review Comment: ```suggestion def import(api_client: Client, file: str | Path, **kwargs): ``` ########## airflow-ctl/src/airflowctl/ctl/cli_config.py: ########## @@ -192,6 +193,33 @@ def __call__(self, parser, namespace, values, option_string=None): nargs="?", ) +ARG_OUTPUT = Arg( + flags=("-o", "--output"), + type=str, + default="table", + choices=("table", "json", "yaml", "plain"), Review Comment: Let's delete the choices we don't support at the moment ########## airflow-ctl/src/airflowctl/ctl/cli_config.py: ########## @@ -192,6 +193,33 @@ def __call__(self, parser, namespace, values, option_string=None): nargs="?", ) +ARG_OUTPUT = Arg( + flags=("-o", "--output"), + type=str, + default="table", + choices=("table", "json", "yaml", "plain"), + metavar="(table, json, yaml, plain)", Review Comment: Same here for support -- 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]
