Skip to content

Purge

get_purge_job(purge_id) async

Get purge job status.

Parameters:

Name Type Description Default
purge_id int

The ID of the purge job to get status for.

required

Returns:

Type Description
ExecHistory

The audit log rotation job status.

stop_purge_job(purge_id) async

Stop a purge job.

Parameters:

Name Type Description Default
purge_id int

The ID of the purge job to stop.

required

get_purge_job_log(purge_id) async

Get the the log of a purge job.

Parameters:

Name Type Description Default
purge_id int

The ID of the log rotation to get.

required

Returns:

Type Description
str

The log rotation log

get_purge_job_schedule() async

Get the current purge job schedule.

Returns:

Type Description
ExecHistory

The purge audit log schedule.

create_purge_job_schedule(schedule) async

Create a purge job schedule.

Examples:

Create a new schedule based on the official sample values for a schedule:

from harborapi.models import Schedule, ScheduleObj

Schedule(
    parameters={
        "audit_retention_hour": 168,
        "dry_run": True,
        "include_operations": "create,delete,pull",
    },
    schedule=ScheduleObj(
        cron="0 0 * * *",
        type="Hourly",
    ),
)

Parameters:

Name Type Description Default
schedule Schedule

The new schedule to use.

required

Returns:

Type Description
str

The location of the new purge job schedule.

update_purge_job_schedule(schedule) async

Update the schedule for a purge job.

Parameters:

Name Type Description Default
schedule Schedule

The new schedule to use.

required

get_purge_job_history(query=None, sort=None, page=1, page_size=10, limit=None) async

Get previous purge job results.

Parameters:

Name Type Description Default
page int

The page number to start iterating from, by default 1

1
page_size int

Number of results to retrieve per page, by default 10

10
sort Optional[str]

Comma-separated string of fields to sort by. Prefix with - to sort descending. E.g. "update_time,-event_type"

None
query Optional[str]

Comma-separated string of query patterns to filter by. The query pattern is in the format of "k=v".

The value of query can be:

* string(enclosed by `"` or `'`)
* integer
* time(in format `"2020-04-09 02:36:00"`)

All of these query patterns should be put in the query string and separated by ",". e.g. "k1=v1,k2=~v2,k3=[min~max]"

None
limit Optional[int]

The maximum number of purge jobs to return.

None

Returns:

Type Description
List[ExecHistory]

A list of purge jobs jobs matching the query.