Skip to content

Commit 8c1aaa3

Browse files
max-wittigJohnVillalovos
authored andcommitted
1 parent f4f7d7a commit 8c1aaa3

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

docs/gl_objects/protected_container_repositories.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ References
1111

1212
+ :class:`gitlab.v4.objects.ProjectRegistryRepositoryProtectionRuleRule`
1313
+ :class:`gitlab.v4.objects.ProjectRegistryRepositoryProtectionRuleRuleManager`
14-
+ :attr:`gitlab.v4.objects.Project.registry_repository_protection_rules`
14+
+ :attr:`gitlab.v4.objects.Project.registry_protection_repository_rules`
1515

1616
* GitLab API: https://docs.gitlab.com/ee/api/container_repository_protection_rules.html
1717

@@ -20,11 +20,11 @@ Examples
2020

2121
List the container registry protection rules for a project::
2222

23-
registry_rules = project.registry_repository_protection_rules.list()
23+
registry_rules = project.registry_protection_repository_rules.list()
2424

2525
Create a container registry protection rule::
2626

27-
registry_rule = project.registry_repository_protection_rules.create(
27+
registry_rule = project.registry_protection_repository_rules.create(
2828
{
2929
'repository_path_pattern': 'test/image',
3030
'minimum_access_level_for_push': 'maintainer',
@@ -39,6 +39,6 @@ Update a container registry protection rule::
3939

4040
Delete a container registry protection rule::
4141

42-
registry_rule = project.registry_repository_protection_rules.delete(registry_rule.id)
42+
registry_rule = project.registry_protection_repository_rules.delete(registry_rule.id)
4343
# or
4444
registry_rule.delete()

gitlab/v4/objects/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@
5555
from .project_access_tokens import *
5656
from .projects import *
5757
from .push_rules import *
58+
from .registry_protection_repository_rules import *
5859
from .registry_protection_rules import *
59-
from .registry_repository_protection_rules import *
6060
from .releases import *
6161
from .repositories import *
6262
from .resource_groups import *

gitlab/v4/objects/projects.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,12 @@
8686
)
8787
from .project_access_tokens import ProjectAccessTokenManager # noqa: F401
8888
from .push_rules import ProjectPushRulesManager # noqa: F401
89+
from .registry_protection_repository_rules import ( # noqa: F401
90+
ProjectRegistryRepositoryProtectionRuleManager,
91+
)
8992
from .registry_protection_rules import ( # noqa: F401; deprecated
9093
ProjectRegistryProtectionRuleManager,
9194
)
92-
from .registry_repository_protection_rules import ( # noqa: F401
93-
ProjectRegistryRepositoryProtectionRuleManager,
94-
)
9595
from .releases import ProjectReleaseManager # noqa: F401
9696
from .repositories import RepositoryMixin
9797
from .resource_groups import ProjectResourceGroupManager
@@ -242,7 +242,7 @@ class Project(
242242
protectedtags: ProjectProtectedTagManager
243243
pushrules: ProjectPushRulesManager
244244
registry_protection_rules: ProjectRegistryProtectionRuleManager
245-
registry_repository_protection_rules: ProjectRegistryRepositoryProtectionRuleManager
245+
registry_protection_repository_rules: ProjectRegistryRepositoryProtectionRuleManager
246246
releases: ProjectReleaseManager
247247
resource_groups: ProjectResourceGroupManager
248248
remote_mirrors: "ProjectRemoteMirrorManager"

gitlab/v4/objects/registry_repository_protection_rules.py renamed to gitlab/v4/objects/registry_protection_repository_rules.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class ProjectRegistryRepositoryProtectionRule(SaveMixin, RESTObject):
1515
class ProjectRegistryRepositoryProtectionRuleManager(
1616
ListMixin, CreateMixin, UpdateMixin, RESTManager
1717
):
18-
_path = "/projects/{project_id}/registry/repository/protection/rules"
18+
_path = "/projects/{project_id}/registry/protection/repository/rules"
1919
_obj_cls = ProjectRegistryRepositoryProtectionRule
2020
_from_parent_attrs = {"project_id": "id"}
2121
_create_attrs = RequiredOptional(

tests/functional/api/test_registry.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ def protected_registry_feature(gl: Gitlab):
1111

1212
@pytest.mark.skip(reason="Not released yet")
1313
def test_project_protected_registry(project: Project):
14-
rules = project.registry_repository_protection_rules.list()
14+
rules = project.registry_protection_repository_rules.list()
1515
assert isinstance(rules, list)
1616

17-
protected_registry = project.registry_repository_protection_rules.create(
17+
protected_registry = project.registry_protection_repository_rules.create(
1818
{
1919
"repository_path_pattern": "test/image",
2020
"minimum_access_level_for_push": "maintainer",

tests/unit/objects/test_registry_protection_rules.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def resp_list_protected_registries():
2121
with responses.RequestsMock() as rsps:
2222
rsps.add(
2323
method=responses.GET,
24-
url="http://localhost/api/v4/projects/1/registry/repository/protection/rules",
24+
url="http://localhost/api/v4/projects/1/registry/protection/repository/rules",
2525
json=[protected_registry_content],
2626
content_type="application/json",
2727
status=200,
@@ -34,7 +34,7 @@ def resp_create_protected_registry():
3434
with responses.RequestsMock() as rsps:
3535
rsps.add(
3636
method=responses.POST,
37-
url="http://localhost/api/v4/projects/1/registry/repository/protection/rules",
37+
url="http://localhost/api/v4/projects/1/registry/protection/repository/rules",
3838
json=protected_registry_content,
3939
content_type="application/json",
4040
status=201,
@@ -50,7 +50,7 @@ def resp_update_protected_registry():
5050
with responses.RequestsMock() as rsps:
5151
rsps.add(
5252
method=responses.PATCH,
53-
url="http://localhost/api/v4/projects/1/registry/repository/protection/rules/1",
53+
url="http://localhost/api/v4/projects/1/registry/protection/repository/rules/1",
5454
json=updated_content,
5555
content_type="application/json",
5656
status=200,
@@ -59,13 +59,13 @@ def resp_update_protected_registry():
5959

6060

6161
def test_list_project_protected_registries(project, resp_list_protected_registries):
62-
protected_registry = project.registry_repository_protection_rules.list()[0]
62+
protected_registry = project.registry_protection_repository_rules.list()[0]
6363
assert isinstance(protected_registry, ProjectRegistryRepositoryProtectionRule)
6464
assert protected_registry.repository_path_pattern == "test/image"
6565

6666

6767
def test_create_project_protected_registry(project, resp_create_protected_registry):
68-
protected_registry = project.registry_repository_protection_rules.create(
68+
protected_registry = project.registry_protection_repository_rules.create(
6969
{
7070
"repository_path_pattern": "test/image",
7171
"minimum_access_level_for_push": "maintainer",
@@ -76,7 +76,7 @@ def test_create_project_protected_registry(project, resp_create_protected_regist
7676

7777

7878
def test_update_project_protected_registry(project, resp_update_protected_registry):
79-
updated = project.registry_repository_protection_rules.update(
79+
updated = project.registry_protection_repository_rules.update(
8080
1, {"repository_path_pattern": "abc*"}
8181
)
8282
assert updated["repository_path_pattern"] == "abc*"

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy