shubhamraj-git commented on code in PR #45577:
URL: https://github.com/apache/airflow/pull/45577#discussion_r1912446238


##########
airflow/api_fastapi/core_api/datamodels/variables.py:
##########
@@ -73,3 +74,50 @@ class VariablesImportResponse(BaseModel):
     created_variable_keys: list[str]
     import_count: int
     created_count: int
+
+
+class VariableActionCreate(BaseModel):
+    """Bulk Create Variable serializer for request bodies."""
+
+    action: Literal["create"] = "create"
+    variables: list[VariableBody] = Field(..., description="A list of 
variables to be created.")
+    action_if_exists: Literal["skip", "overwrite", "fail"] = "fail"
+
+
+class VariableActionUpdate(BaseModel):
+    """Bulk Update Variable serializer for request bodies."""
+
+    action: Literal["update"] = "update"
+    variables: list[VariableBody] = Field(..., description="A list of 
variables to be updated.")
+    action_if_not_exists: Literal["skip", "fail"] = "fail"
+
+
+class VariableActionDelete(BaseModel):
+    """Bulk Delete Variable serializer for request bodies."""
+
+    action: Literal["delete"] = "delete"
+    keys: list[str] = Field(..., description="A list of variable keys to be 
deleted.")
+    action_if_not_exists: Literal["skip", "fail"] = "fail"
+
+
+class BulkVariablesBody(BaseModel):
+    """Request body for bulk variable operations (create, update, delete)."""
+
+    actions: list[VariableActionCreate | VariableActionUpdate | 
VariableActionDelete] = Field(
+        ..., description="A list of variable actions to perform."
+    )
+
+
+class BulkActionResponse(BaseModel):
+    """Bulk Action serializer for responses."""
+
+    success: list[str] = []
+    errors: list[dict[str, Any]] = []
+
+
+class BulkVariableResponse(BaseModel):
+    """Bulk Variable operation serializer for responses."""
+
+    create: BulkActionResponse | None = Field(default=None)
+    update: BulkActionResponse | None = Field(default=None)
+    delete: BulkActionResponse | None = Field(default=None)

Review Comment:
   improved it, let me know if that needs to be rectified more.



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