Skip to content

Create a container repository protection rule

POST
/api/v4/projects/{id}/registry/protection/repository/rules

Creates a container repository protection rule for a specified project to control who can push or delete container images.

id
required
One of:
string

The ID or URL-encoded path of the project

Media type application/json
object
repository_path_pattern
required

Container repository path pattern protected by the protection rule. For example flight/flight-*. Wildcard character * allowed.

string
nullable
minimum_access_level_for_push

Minimum GitLab access level to allow to push container images to the container registry. For example maintainer, owner or admin.

string
nullable
Allowed values: maintainer owner admin
minimum_access_level_for_delete

Minimum GitLab access level to allow to delete container images in the container registry. For example maintainer, owner or admin.

string
nullable
Allowed values: maintainer owner admin

Created

Media type application/json
object
id
integer format: int64
project_id
integer format: int64
repository_path_pattern
string
minimum_access_level_for_push
string
minimum_access_level_for_delete
string
Example
{
"id": 1,
"project_id": 1,
"repository_path_pattern": "flightjs/flight0",
"minimum_access_level_for_push": "maintainer",
"minimum_access_level_for_delete": "maintainer"
}

Bad Request

Unauthorized

Forbidden

Not Found

Unprocessable Entity