shahar1 commented on code in PR #56324:
URL: https://github.com/apache/airflow/pull/56324#discussion_r2724150385


##########
providers/google/src/airflow/providers/google/common/hooks/base_google.py:
##########
@@ -347,9 +377,51 @@ def get_credentials_and_project_id(self) -> 
tuple[Credentials, str | None]:
 
         return credentials, project_id
 
+    def _validate_quota_project(self, quota_project: str | None) -> None:
+        """Validate the quota project ID format and existence.
+
+        :param quota_project: The quota project ID to validate
+        :raises AirflowException: If the quota project ID is invalid
+        """
+        if quota_project is not None:
+            if not isinstance(quota_project, str):
+                raise AirflowException(f"quota_project_id must be a string, 
got {type(quota_project)}")
+            if not quota_project.strip():
+                raise AirflowException("quota_project_id cannot be empty")
+            # Check for valid GCP project ID format
+            if not re.match(r"^[a-z][-a-z0-9]{4,28}[a-z0-9]$", quota_project):

Review Comment:
   Nice! It seems like a useful regex expression which we could utilize to any 
input which is a a GCP project ID across the project. Maybe you could extract 
it to a common utility function? (you don't have to implement the validation 
for the other inputs as part of this PR)



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