Module: Gitlab::Client::RemoteMirrors

Included in:
Gitlab::Client
Defined in:
lib/gitlab/client/remote_mirrors.rb

Overview

Defines methods related to remote mirrors.

Instance Method Summary collapse

Instance Method Details

#create_remote_mirror(project, url, options = {}) ⇒ Gitlab::ObjectifiedHash

Create a remote mirror

Examples:

Gitlab.create_remote_mirror(42, 'https://[email protected]/gitlab-org/gitlab.git', enabled: true)

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • url (String)

    The full URL of the remote repository.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :enabled (Boolean)

    Determines if the mirror is enabled.

  • :only_protected_branches (Boolean)

    Determines if only protected branches are mirrored.

  • :keep_divergent_refs (Boolean)

    Determines if divergent refs are skipped.

Returns:



31
32
33
# 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 = {}) ⇒ Gitlab::ObjectifiedHash

Update a remote mirror’s attributes

Examples:

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

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • id (Integer)

    The ID of the remote mirror.

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • :enabled (Boolean)

    Determines if the mirror is enabled.

  • :only_protected_branches (Boolean)

    Determines if only protected branches are mirrored.

  • :keep_divergent_refs (Boolean)

    Determines if divergent refs are skipped.

Returns:



47
48
49
# 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) ⇒ Array<Gitlab::ObjectifiedHash>

List a project’s remote mirrors

Examples:

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

Parameters:

  • project (Integer, String)

    The ID or name of a project.

Returns:



15
16
17
# File 'lib/gitlab/client/remote_mirrors.rb', line 15

def remote_mirrors(project)
  get("/projects/#{url_encode project}/remote_mirrors")
end