Skip to content

Commit

Permalink
Fix replication filter (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
pederhan authored Mar 1, 2024
1 parent 3a5afda commit 6d693a9
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,14 @@ While the project is still on major version 0, breaking changes may be introduce

## Unreleased

## Added
### Added

- `verify` parameter for `HarborAsyncClient.authenticate()`.
- New model field: `ProjectMetadata.auto_sbom_generation`

### Fixed

- `ReplicationFilter.value` validation failing due to receiving non-dict value. Now accepts `str`, `dict[str, Any]` and `None`.

## [0.23.1](https://github.com/unioslo/harborapi/tree/harborapi-v0.23.1) - 2024-01-22

Expand Down
13 changes: 13 additions & 0 deletions codegen/ast/fragments/main/replicationfilter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from __future__ import annotations

from typing import Any
from typing import Dict
from typing import Union

from pydantic import Field


class ReplicationFilter(BaseModel):
value: Union[str, Dict[str, Any], None] = Field(
None, description="The value of replication policy filter."
)
14 changes: 10 additions & 4 deletions harborapi/models/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,10 @@ class ProjectMetadata(BaseModel):
None,
description='Whether scan images automatically when pushing. The valid values are "true", "false".',
)
auto_sbom_generation: Optional[str] = Field(
None,
description='Whether generating SBOM automatically when pushing a subject artifact. The valid values are "true", "false".',
)
reuse_sys_cve_allowlist: Optional[str] = Field(
None,
description='Whether this project reuse the system level CVE allowlist as the allowlist of its own. The valid values are "true", "false". If it is set to "true" the actual allowlist associate with this project, if any, will be ignored.',
Expand Down Expand Up @@ -490,7 +494,7 @@ class ReplicationTriggerSettings(BaseModel):

class ReplicationFilter(BaseModel):
type: Optional[str] = Field(None, description="The replication policy filter type.")
value: Optional[Dict[str, Any]] = Field(
value: Union[str, Dict[str, Any], None] = Field(
None, description="The value of replication policy filter."
)
decoration: Optional[str] = Field(
Expand Down Expand Up @@ -757,7 +761,7 @@ class Type(Enum):
class ScheduleObj(BaseModel):
type: Optional[Type] = Field(
None,
description="The schedule type. The valid values are 'Hourly', 'Daily', 'Weekly', 'Custom', 'Manual', 'None' and 'Schedule'.\n'Manual' means to trigger it right away, 'Schedule' means to trigger it by a specified cron schedule and \n'None' means to cancel the schedule.\n",
description="The schedule type. The valid values are 'Hourly', 'Daily', 'Weekly', 'Custom', 'Manual', 'None' and 'Schedule'.\n'Manual' means to trigger it right away, 'Schedule' means to trigger it by a specified cron schedule and\n'None' means to cancel the schedule.\n",
)
cron: Optional[str] = Field(
None, description="A cron expression, a time-based job scheduler."
Expand Down Expand Up @@ -2413,7 +2417,8 @@ class Robot(BaseModel):
None, description="The level of the robot, project or system"
)
duration: Optional[int] = Field(
None, description="The duration of the robot in days"
None,
description="The duration of the robot in days, duration must be either -1(Never) or a positive integer",
)
editable: Optional[bool] = Field(
None, description="The editable status of the robot"
Expand Down Expand Up @@ -2442,7 +2447,8 @@ class RobotCreate(BaseModel):
)
disable: Optional[bool] = Field(None, description="The disable status of the robot")
duration: Optional[int] = Field(
None, description="The duration of the robot in days"
None,
description="The duration of the robot in days, duration must be either -1(Never) or a positive integer",
)
permissions: Optional[List[RobotPermission]] = None

Expand Down

0 comments on commit 6d693a9

Please sign in to comment.