Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
shijl0925 committed Aug 4, 2024
1 parent 0bc434e commit 3815e8d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 33 deletions.
58 changes: 26 additions & 32 deletions sonarqube/rest/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
API_PROJECTS_BULK_DELETE_ENDPOINT,
API_PROJECTS_DELETE_ENDPOINT,
API_PROJECTS_SEARCH_ENDPOINT,
API_PROJECTS_CREATE_PROJECT_ENDPOINT
API_PROJECTS_CREATE_ENDPOINT
)
from sonarqube.utils.common import GET, POST

Expand All @@ -28,6 +28,24 @@ def get_project(self, key, organization=None):

return item

@POST(API_PROJECTS_BULK_DELETE_ENDPOINT)
def bulk_delete_project(self, analyzedBefore=None, onProvisionedOnly=False, projects=None, q=None, qualifiers="TRK"):
"""
SINCE 5.2
Delete one or several projects.
:param analyzedBefore: Filter the projects for which last analysis of any branch is older than the given date (exclusive).
Either a date (server timezone) or datetime can be provided.
:param onProvisionedOnly: Filter the projects that are provisioned
:param projects: Comma-separated list of project keys
:param q: Limit to:
component names that contain the supplied string
component keys that contain the supplied string
:param qualifiers: Comma-separated list of component qualifiers. Filter the results with the specified qualifiers
:return:
"""

@GET(API_PROJECTS_SEARCH_ENDPOINT)
def search_projects(
self,
Expand Down Expand Up @@ -66,53 +84,29 @@ def search_projects(
:return:
"""

@POST(API_PROJECTS_CREATE_PROJECT_ENDPOINT)
def create_project(
self,
name=None,
project=None,
visibility=None
):
@POST(API_PROJECTS_CREATE_ENDPOINT)
def create_project(self, project, name, 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 name: required. Name of the project. If name is longer than 500, it is abbreviated.
: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
"""

@POST(API_PROJECTS_DELETE_ENDPOINT)
def delete_project(self, key):
def delete_project(self, project):
"""
SINCE 5.2
Delete a project
:param key: Project key
:return:
"""

@POST(API_PROJECTS_BULK_DELETE_ENDPOINT)
def bulk_delete_project(
self,
analyzedBefore=None,
onProvisionedOnly=False,
projects=None, q=None,
qualifiers=None):
"""
SINCE 5.2
Delete one or several projects.
:param project: Project key
:param analyzedBefore: Filter the projects for which last analysis of any branch is older than the given date (exclusive).
Either a date (server timezone) or datetime can be provided.
:param onProvisionedOnly: Filter the projects that are provisioned
:param projects: Comma-separated list of project keys
:param q: Limit to:
component names that contain the supplied string
component keys that contain the supplied string
:param qualifiers: Comma-separated list of component qualifiers. Filter the results with the specified qualifiers
:return:
"""
2 changes: 1 addition & 1 deletion sonarqube/utils/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
API_PROJECTS_BULK_DELETE_ENDPOINT = "/api/projects/bulk_delete"
API_PROJECTS_DELETE_ENDPOINT = "/api/projects/delete"
API_PROJECTS_SEARCH_ENDPOINT = "/api/projects/search"
API_PROJECTS_CREATE_PROJECT_ENDPOINT = "/api/projects/create"
API_PROJECTS_CREATE_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 3815e8d

Please sign in to comment.