Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion onekey_client/cli/firmware_upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@
@click.option(
"--sbom", help="Firmware SBOM", type=click.Path(exists=True, path_type=Path)
)
@click.option(
"--timeout",
help="Timeout for HTTP requests",
type=click.IntRange(min=1, max=600),
default=60,
)
@click.option("--monitoring", is_flag=True, default=False, help="Enable monitoring")
@click.option("--label", multiple=True, help="Add a label (repeatable)")
@click.argument(
"filename", type=click.Path(exists=True, path_type=Path), required=False
)
Expand All @@ -45,8 +53,11 @@ def upload_firmware(
vendor_name: str,
product_group_name: str,
analysis_configuration_name: str,
timeout: int,
monitoring: bool,
version: str | None,
name: str | None,
label: tuple[str],
sbom: Path | None,
filename: Path | None,
):
Expand Down Expand Up @@ -75,11 +86,16 @@ def upload_firmware(
product_group_id=product_group_id,
version=version,
analysis_configuration_id=analysis_configuration_id,
labels=list(label),
)

try:
res = client.upload_firmware(
metadata, filename, sbom_path=sbom, enable_monitoring=False
metadata,
filename,
sbom_path=sbom,
enable_monitoring=monitoring,
timeout=timeout,
)
click.echo(res["id"])
except QueryError as e:
Expand Down
1 change: 1 addition & 0 deletions onekey_client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ def upload_firmware(
"notes": metadata.notes,
"enableMonitoring": enable_monitoring,
"analysisConfigurationId": str(metadata.analysis_configuration_id),
"labels": metadata.labels,
},
"vendorName": metadata.vendor_name,
"productName": metadata.product_name,
Expand Down
1 change: 1 addition & 0 deletions onekey_client/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ class FirmwareMetadata(BaseModel):
product_category: str | None = None
product_group_id: UUID
analysis_configuration_id: UUID
labels: list[str] | None = None