import requests
url = "https://platform.ankra.app/api/v1/org/registry-storage/retention"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://platform.ankra.app/api/v1/org/registry-storage/retention', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://platform.ankra.app/api/v1/org/registry-storage/retention \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"retention": {
"organisation_id": "<string>",
"default": {
"keep_days": 1825,
"keep_latest": 500
},
"platform_default": {
"keep_days": 1825,
"keep_latest": 500
},
"source": "default",
"updated_by": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"rules": [
{
"id": "<string>",
"repository_pattern": "<string>",
"application_id": "<string>",
"keep_days": 123,
"keep_latest": 123,
"updated_by": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"recently_pulled_days": 123,
"runs_daily_at": "<string>",
"space_freed_at": "<string>",
"version": "<string>",
"rule_slots": {
"used": 1,
"limit": 2
}
},
"harbor_applied": true,
"harbor_apply_error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Update registry retention
Change the organisation’s project-wide retention policy (null resets it to the platform default), its repository rules (the list replaces the stored one; an empty list removes them all), or both, and apply the result to the registry at once. The newest image of every repository is always kept. harbor_applied false means the change is saved and applies on the next provisioning pass, within about five minutes. Send the version you read as expected_version: if someone changed the retention since, the save answers 409 and writes nothing. A change that needs more retention rules than the registry runs for one project (rule_slots in the read) answers 422 saying how many it needs, and writes nothing. A browser session twin is mounted at the same path without the /api/v1 prefix (cookie authentication).
import requests
url = "https://platform.ankra.app/api/v1/org/registry-storage/retention"
payload = {}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({})
};
fetch('https://platform.ankra.app/api/v1/org/registry-storage/retention', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request PUT \
--url https://platform.ankra.app/api/v1/org/registry-storage/retention \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{}'{
"retention": {
"organisation_id": "<string>",
"default": {
"keep_days": 1825,
"keep_latest": 500
},
"platform_default": {
"keep_days": 1825,
"keep_latest": 500
},
"source": "default",
"updated_by": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"rules": [
{
"id": "<string>",
"repository_pattern": "<string>",
"application_id": "<string>",
"keep_days": 123,
"keep_latest": 123,
"updated_by": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
}
],
"recently_pulled_days": 123,
"runs_daily_at": "<string>",
"space_freed_at": "<string>",
"version": "<string>",
"rule_slots": {
"used": 1,
"limit": 2
}
},
"harbor_applied": true,
"harbor_apply_error": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
The project-wide policy; null resets it to the platform default; omit to leave it.
Show child attributes
Show child attributes
Replaces every repository rule; an empty list removes them all; omit to leave them.
Show child attributes
Show child attributes
The version read with the retention. When sent, the save is refused with 409 if the stored retention has changed since; omit it (or send null) to save without the check. A blank string is refused with 422; surrounding whitespace is ignored.