Module: Gitlab::Client::ProtectedTags

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

Overview

Defines methods related to Protected Tags.

Instance Method Summary collapse

Instance Method Details

#protect_repository_tag(project, name, options = {}) ⇒ Gitlab::ObjectifiedHash

Protects a single repository tag or several project repository tags using a wildcard protected tag.

Examples:

Gitlab.protect_repository_tag(1, 'release-1-0')
Gitlab.protect_repository_tag(1, 'release-1-0', create_access_level: 30)

Parameters:

  • project(required) (Integer, String)

    The ID or name of a project.

  • name(required) (String)

    The name of the tag or wildcard

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

    a customizable set of options

Options Hash (options):

  • :create_access_level (Integer)

    Access levels allowed to create (defaults: 40, maintainer access level)

Returns:



42
43
44
45
# File 'lib/gitlab/client/protected_tags.rb', line 42

def protect_repository_tag(project, name, options = {})
  body = { name: name }.merge(options)
  post("/projects/#{url_encode project}/protected_tags", body: body)
end

#protected_tag(project, name) ⇒ Gitlab::ObjectifiedHash

Gets a single protected tag or wildcard protected tag.

Examples:

Gitlab.protected_tag(1, 'release-1-0')

Parameters:

  • project(required) (Integer, String)

    The ID or name of a project.

  • name(required) (String)

    The name of the tag or wildcard

Returns:



28
29
30
# File 'lib/gitlab/client/protected_tags.rb', line 28

def protected_tag(project, name)
  get("/projects/#{url_encode project}/protected_tags/#{name}")
end

#protected_tags(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Gets a list of protected tags from a project

Examples:

Gitlab.protected_tags(1)

Parameters:

  • project(required) (Integer, String)

    The ID or name of a project.

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

    a customizable set of options

Options Hash (options):

  • :page (Integer)

    The page number.

  • :per_page (Integer)

    The number of results per page.

Returns:



16
17
18
# File 'lib/gitlab/client/protected_tags.rb', line 16

def protected_tags(project, options = {})
  get("/projects/#{url_encode project}/protected_tags", query: options)
end

#unprotect_repository_tag(project, name) ⇒ nil

Unprotects the given protected tag or wildcard protected tag.

Examples:

Gitlab.unprotect_repository_tag(1, 'release-1-0')

Parameters:

  • project(required) (Integer, String)

    The ID or name of a project.

  • name(required) (String)

    The name of the tag or wildcard

Returns:

  • (nil)

    This API call returns an empty response body.



55
56
57
# File 'lib/gitlab/client/protected_tags.rb', line 55

def unprotect_repository_tag(project, name)
  delete("/projects/#{url_encode project}/protected_tags/#{name}")
end