diff options
| author | Ben Brown <ben@demerara.io> | 2022-11-07 22:22:26 +0000 |
|---|---|---|
| committer | Nejc Habjan <hab.nejc@gmail.com> | 2022-11-10 13:16:57 +0100 |
| commit | d0a034878fabfd8409134aa8b7ffeeb40219683c (patch) | |
| tree | d3291921754730426ee36a659596fa151d665d25 /docs | |
| parent | fcd72fe243daa0623abfde267c7ab1c6866bcd52 (diff) | |
| download | gitlab-d0a034878fabfd8409134aa8b7ffeeb40219683c.tar.gz | |
feat: implement secure files API
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/api-objects.rst | 1 | ||||
| -rw-r--r-- | docs/gl_objects/secure_files.rst | 47 |
2 files changed, 48 insertions, 0 deletions
diff --git a/docs/api-objects.rst b/docs/api-objects.rst index c025056..cccf1c6 100644 --- a/docs/api-objects.rst +++ b/docs/api-objects.rst @@ -52,6 +52,7 @@ API examples gl_objects/repositories gl_objects/repository_tags gl_objects/search + gl_objects/secure_files gl_objects/settings gl_objects/snippets gl_objects/statistics diff --git a/docs/gl_objects/secure_files.rst b/docs/gl_objects/secure_files.rst new file mode 100644 index 0000000..e7374bb --- /dev/null +++ b/docs/gl_objects/secure_files.rst @@ -0,0 +1,47 @@ +############ +Secure Files +############ + +secure files +============ + +References +---------- + +* v4 API: + + + :class:`gitlab.v4.objects.SecureFile` + + :class:`gitlab.v4.objects.SecureFileManager` + + :attr:`gitlab.v4.objects.Project.secure_files` + +* GitLab API: https://docs.gitlab.com/ee/api/secure_files.html + +Examples +-------- + +Get a project secure file:: + + secure_files = gl.projects.get(1, lazy=True).secure_files.get(1) + print(secure_files.name) + +List project secure files:: + + secure_files = gl.projects.get(1, lazy=True).secure_files.list() + print(secure_files[0].name) + +Create project secure file:: + + secure_file = gl.projects.get(1).secure_files.create({"name": "test", "file": "secure.txt"}) + +Download a project secure file:: + + content = secure_file.download() + print(content) + with open("/tmp/secure.txt", "wb") as f: + secure_file.download(streamed=True, action=f.write) + +Remove a project secure file:: + + gl.projects.get(1).secure_files.delete(1) + # or + secure_file.delete() |
