diff --git a/sonarqube/rest/projects.py b/sonarqube/rest/projects.py index f14878b..54d696a 100644 --- a/sonarqube/rest/projects.py +++ b/sonarqube/rest/projects.py @@ -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 @@ -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, @@ -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: """ diff --git a/sonarqube/utils/config.py b/sonarqube/utils/config.py index 8c01382..fbbba22 100644 --- a/sonarqube/utils/config.py +++ b/sonarqube/utils/config.py @@ -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"