From e9c2bf267862e22c0770cc7b3a1ed97a8b87a7fd Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Tue, 3 Mar 2020 18:08:16 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- lib/api/remote_mirrors.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/api/remote_mirrors.rb') 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 -- cgit v1.2.1