Skip to content

Commit

Permalink
add delete_project and batch_delete_project
Browse files Browse the repository at this point in the history
  • Loading branch information
nobody committed Mar 12, 2024
1 parent 248b0d5 commit c9dcf5d
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
33 changes: 33 additions & 0 deletions sonarqube/rest/projects.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# @Author: Jialiang Shi
from sonarqube.utils.rest_client import RestClient
from sonarqube.utils.config import (
API_PROJECTS_BULK_DELETE_ENDPOINT,
API_PROJECTS_DELETE_ENDPOINT,
API_PROJECTS_SEARCH_ENDPOINT,
)
from sonarqube.utils.common import GET, POST
Expand Down Expand Up @@ -67,3 +69,34 @@ def search_projects(
:return:
"""
@POST(API_PROJECTS_DELETE_ENDPOINT)
def delete_project(self, key):
"""
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 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: 2 additions & 0 deletions sonarqube/utils/config.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
API_COMPONENTS_SHOW_ENDPOINT = "/api/components/show"

API_PROJECTS_BULK_DELETE_ENDPOINT = "/api/projects/bulk_delete"
API_PROJECTS_DELETE_ENDPOINT = "/api/projects/delete"
API_PROJECTS_SEARCH_ENDPOINT = "/api/projects/search"

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

0 comments on commit c9dcf5d

Please sign in to comment.