Skip to content

Commit

Permalink
Add support for project deletion (with plugin) (#147)
Browse files Browse the repository at this point in the history
delete-project is one of the blessed gerrit plugins.  This change
enables us to use it to delete existing projects.
  • Loading branch information
kellyma2 authored Jun 28, 2023
1 parent 423d372 commit 2dcb9fb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ type ProjectInput struct {
PluginConfigValues map[string]map[string]string `json:"plugin_config_values,omitempty"`
}

// DeleteOptionsInfo entity contains information for the deletion of a project.
type DeleteOptionsInfo struct {
Force bool `json:"force"`
Preserve bool `json:"preserve"`
}

// GCInput entity contains information to run the Git garbage collection.
type GCInput struct {
ShowProgress bool `json:"show_progress"`
Expand Down Expand Up @@ -246,6 +252,17 @@ func (s *ProjectsService) CreateProject(projectName string, input *ProjectInput)
return v, resp, err
}

// DeleteProject deletes a project
//
// Note: requires installation of delete-project plugin
//
// Gerrit API docs: https://gerrit.googlesource.com/plugins/delete-project/+/refs/heads/master/src/main/resources/Documentation/rest-api-projects.md
func (s *ProjectsService) DeleteProject(projectName string, input *DeleteOptionsInfo) (*Response, error) {
u := fmt.Sprintf("projects/%s", projectName)

return s.client.DeleteRequest(u, input)
}

// GetProjectDescription retrieves the description of a project.
//
// Gerrit API docs: https://gerrit-review.googlesource.com/Documentation/rest-api-projects.html#get-project-description
Expand Down

0 comments on commit 2dcb9fb

Please sign in to comment.