sidshas03 commented on code in PR #55744:
URL: https://github.com/apache/airflow/pull/55744#discussion_r2356310503
##########
airflow-ctl/src/airflowctl/api/operations.py:
##########
@@ -238,13 +239,23 @@ def list_by_alias(self) -> AssetAliasCollectionResponse |
ServerResponseError:
"""List all assets by alias from the API server."""
return super().execute_list(path="/assets/aliases",
data_model=AssetAliasCollectionResponse)
+ def create(self, asset_body: CreateAssetBody) -> AssetResponse |
ServerResponseError:
+ """Create an asset."""
+ try:
+ self.response = self.client.post(
+ "/assets", json=_date_safe_dict_from_pydantic(asset_body)
+ )
+ return AssetResponse.model_validate_json(self.response.content)
+ except ServerResponseError as e:
+ raise e
+
def create_event(
self, asset_event_body: CreateAssetEventsBody
) -> AssetEventResponse | ServerResponseError:
"""Create an asset event."""
try:
self.response = self.client.post(
- "assets/events",
json=_date_safe_dict_from_pydantic(asset_event_body)
+ "/assets/events",
json=_date_safe_dict_from_pydantic(asset_event_body)
Review Comment:
Done! left only the "/assets/events" change here; everything else will go
into the follow-up 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]