Skip to content

Commit

Permalink
Add create_project
Browse files Browse the repository at this point in the history
  • Loading branch information
Andres Felipe Bermudez Sanchez committed Mar 13, 2024
1 parent 248b0d5 commit 1fef075
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
19 changes: 19 additions & 0 deletions sonarqube/rest/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from sonarqube.utils.rest_client import RestClient
from sonarqube.utils.config import (
API_PROJECTS_SEARCH_ENDPOINT,
API_PROJECTS_CREATE_PROJECT_ENDPOINT
)
from sonarqube.utils.common import GET, POST

Expand Down Expand Up @@ -67,3 +68,21 @@ def search_projects(
:return:
"""
@POST(API_PROJECTS_CREATE_PROJECT_ENDPOINT)
def create_project(
self,
name=None,
project=None,
visibility=None
):
"""
SINCE 4.0
Create a project. Requires 'Create Projects' permission.
:param: name: required. Name of the project. If name is longer than 500, it is abbreviated.
:param project: required. Key of the project
:param visibility: Whether the created project should be visible to everyone, or only specific user/groups.
If no visibility is specified, the default project visibility of the organization will be used.
Possible values
* private
* public
"""
1 change: 1 addition & 0 deletions sonarqube/utils/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
API_COMPONENTS_SHOW_ENDPOINT = "/api/components/show"

API_PROJECTS_SEARCH_ENDPOINT = "/api/projects/search"
API_PROJECTS_CREATE_PROJECT_ENDPOINT = "/api/projects/create"

API_USERS_SEARCH_ENDPOINT = "/api/users/search"
API_USER_GROUPS_SEARCH_ENDPOINT = "/api/user_groups/search"
Expand Down

0 comments on commit 1fef075

Please sign in to comment.