Skip to content

Commit

Permalink
Merge pull request #97 from tstng/master
Browse files Browse the repository at this point in the history
Add create_project
  • Loading branch information
shijl0925 committed Aug 4, 2024
2 parents 5935f27 + 1fef075 commit 39a633b
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

Expand Down Expand Up @@ -62,3 +63,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 39a633b

Please sign in to comment.