module Gitlab::Client::RemoteMirrors

Defines methods related to remote mirrors. @see docs.gitlab.com/ee/api/remote_mirrors.html

Public Instance Methods

create_remote_mirror(project, url, options = {}) click to toggle source

Create a remote mirror

@example

Gitlab.create_remote_mirror(42, 'https://mirror-bot@gitlab.com/gitlab-org/gitlab.git', enabled: true)

@param [Integer, String] project The ID or name of a project. @param [String] url The full URL of the remote repository. @param [Hash] options A customizable set of options. @option options [Boolean] :enabled Determines if the mirror is enabled. @option options [Boolean] :only_protected_branches Determines if only protected branches are mirrored. @option options [Boolean] :keep_divergent_refs Determines if divergent refs are skipped. @return [Gitlab::ObjectifiedHash]

# File lib/gitlab/client/remote_mirrors.rb, line 31
def create_remote_mirror(project, url, options = {})
  post("/projects/#{url_encode project}/remote_mirrors", body: options.merge(url: url))
end
edit_remote_mirror(project, id, options = {}) click to toggle source

Update a remote mirror’s attributes

@example

Gitlab.edit_remote_mirror(42, 66, only_protected_branches: true)

@param [Integer, String] project The ID or name of a project. @param [Integer] id The ID of the remote mirror. @param [Hash] options A customizable set of options. @option options [Boolean] :enabled Determines if the mirror is enabled. @option options [Boolean] :only_protected_branches Determines if only protected branches are mirrored. @option options [Boolean] :keep_divergent_refs Determines if divergent refs are skipped. @return [Gitlab::ObjectifiedHash]

# File lib/gitlab/client/remote_mirrors.rb, line 47
def edit_remote_mirror(project, id, options = {})
  put("/projects/#{url_encode project}/remote_mirrors/#{id}", body: options)
end
remote_mirrors(project) click to toggle source

List a project’s remote mirrors

@example

Gitlab.remote_mirrors(42)
Gitlab.remote_mirrors('gitlab-org/gitlab')

@param [Integer, String] project The ID or name of a project. @return [Array<Gitlab::ObjectifiedHash>]

# File lib/gitlab/client/remote_mirrors.rb, line 15
def remote_mirrors(project)
  get("/projects/#{url_encode project}/remote_mirrors")
end