yunchipang commented on code in PR #50556:
URL: https://github.com/apache/airflow/pull/50556#discussion_r2136897463


##########
airflow-ctl/src/airflowctl/ctl/commands/config_command.py:
##########
@@ -0,0 +1,825 @@
+#
+# 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 sys
+from dataclasses import dataclass
+from typing import TYPE_CHECKING, Any, NamedTuple
+
+import rich
+
+from airflowctl.api.client import NEW_API_CLIENT, ClientKind, 
provide_api_client
+
+if TYPE_CHECKING:
+    from airflowctl.api.datamodels.generated import Config
+
+
+class ConfigParameter(NamedTuple):
+    """Represents a configuration parameter."""
+
+    section: str
+    option: str
+
+
+@dataclass
+class ConfigChange:
+    """
+    Class representing the configuration changes in Airflow 3.0.
+
+    :param config: The configuration parameter being changed.
+    :param default_change: If the change is a default value change.
+    :param old_default: The old default value (valid only if default_change is 
True).
+    :param new_default: The new default value for the configuration parameter.
+    :param suggestion: A suggestion for replacing or handling the removed 
configuration.
+    :param renamed_to: The new section and option if the configuration is 
renamed.
+    :param was_deprecated: If the config is removed, whether the old config 
was deprecated.
+    :param was_removed: If the config is removed.
+    :param is_invalid_if: If the current config value is invalid in the future.
+    :param breaking: Mark if this change is known to be breaking and causing 
errors/ warnings / deprecations.
+    :param remove_if_equals: For removal rules, remove the option only if its 
current value equals this value.
+    """
+
+    config: ConfigParameter
+    default_change: bool = False
+    old_default: str | bool | int | float | None = None
+    new_default: str | bool | int | float | None = None
+    suggestion: str = ""
+    renamed_to: ConfigParameter | None = None
+    was_deprecated: bool = True
+    was_removed: bool = True
+    is_invalid_if: Any = None
+    breaking: bool = False
+    remove_if_equals: str | bool | int | float | None = None
+
+    def message(self, api_client=NEW_API_CLIENT) -> str | None:
+        """Generate a message for this configuration change."""
+        if self.default_change:
+            value = self._get_option_value(api_client.configs.list())
+            if value != self.new_default:

Review Comment:
   @bugraoz93 logic in `message()` is updated accordingly. thanks for the 
suggestion! please take a look at `lint()` and the added `TestCliConfigLint` 
class. lmk any thoughts!



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