diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-03 18:08:16 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-03 18:08:16 +0000 |
commit | e9c2bf267862e22c0770cc7b3a1ed97a8b87a7fd (patch) | |
tree | 7b778e44f210132af1233ceb8801b388ac3519f5 /lib/api/remote_mirrors.rb | |
parent | 946771d0b016ae92b15a60bc3290a33b94191ffe (diff) | |
download | gitlab-ce-e9c2bf267862e22c0770cc7b3a1ed97a8b87a7fd.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/api/remote_mirrors.rb')
-rw-r--r-- | lib/api/remote_mirrors.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/api/remote_mirrors.rb b/lib/api/remote_mirrors.rb index 95313966133..bdaec67108d 100644 --- a/lib/api/remote_mirrors.rb +++ b/lib/api/remote_mirrors.rb @@ -26,6 +26,26 @@ module API with: Entities::RemoteMirror end + desc 'Create remote mirror for a project' do + success Entities::RemoteMirror + end + params do + requires :url, type: String, desc: 'The URL for a remote mirror' + optional :enabled, type: Boolean, desc: 'Determines if the mirror is enabled' + optional :only_protected_branches, type: Boolean, desc: 'Determines if only protected branches are mirrored' + end + post ':id/remote_mirrors' do + create_params = declared_params(include_missing: false) + + new_mirror = user_project.remote_mirrors.create(create_params) + + if new_mirror.persisted? + present new_mirror, with: Entities::RemoteMirror + else + render_validation_error!(new_mirror) + end + end + desc 'Update the attributes of a single remote mirror' do success Entities::RemoteMirror end |