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:

 44 45 46
# File 'lib/gitlab/client/remote_mirrors.rb', line 44 def create_remote_mirror(project, url, options = {}) post("/projects/#{url_encode project}/remote_mirrors", body: options.merge(url: url)) end 

#delete_remote_mirror(project, id) ⇒ Gitlab::ObjectifiedHash

Delete a remote mirror.

Examples:

Gitlab.delete_remote_mirror(42, 1234) 

Parameters:

  • project (Integer, String)

    The ID or path of a project.

  • id (Integer)

    The ID of the remote mirror.

Returns:

 73 74 75
# File 'lib/gitlab/client/remote_mirrors.rb', line 73 def delete_remote_mirror(project, id) delete("/projects/#{url_encode project}/remote_mirrors/#{id}") 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:

 60 61 62
# File 'lib/gitlab/client/remote_mirrors.rb', line 60 def edit_remote_mirror(project, id, options = {}) put("/projects/#{url_encode project}/remote_mirrors/#{id}", body: options) end 

#remote_mirror(project, id) ⇒ Gitlab::ObjectifiedHash

Get a specific remote mirror.

Examples:

Gitlab.remote_mirror(42, 1234) 

Parameters:

  • project (Integer, String)

    The ID or path of a project.

  • id (Integer)

    The ID of the remote mirror.

Returns:

 28 29 30
# File 'lib/gitlab/client/remote_mirrors.rb', line 28 def remote_mirror(project, id) get("/projects/#{url_encode project}/remote_mirrors/#{id}") 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 

#sync_remote_mirror(project, id) ⇒ Gitlab::ObjectifiedHash

Force push mirror update.

Examples:

Gitlab.sync_remote_mirror(42, 1234) 

Parameters:

  • project (Integer, String)

    The ID or path of a project.

  • id (Integer)

    The ID of the remote mirror.

Returns:

 86 87 88
# File 'lib/gitlab/client/remote_mirrors.rb', line 86 def sync_remote_mirror(project, id) post("/projects/#{url_encode project}/remote_mirrors/#{id}/sync") end