-
Notifications
You must be signed in to change notification settings - Fork 55
/
builddiscard.go
42 lines (34 loc) · 1.19 KB
/
builddiscard.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package buildinfo
import (
"github.com/jfrog/jfrog-cli-core/artifactory/utils"
"github.com/jfrog/jfrog-cli-core/utils/config"
"github.com/jfrog/jfrog-client-go/artifactory/services"
)
type BuildDiscardCommand struct {
rtDetails *config.ArtifactoryDetails
services.DiscardBuildsParams
}
func NewBuildDiscardCommand() *BuildDiscardCommand {
return &BuildDiscardCommand{}
}
func (buildDiscard *BuildDiscardCommand) SetRtDetails(rtDetails *config.ArtifactoryDetails) *BuildDiscardCommand {
buildDiscard.rtDetails = rtDetails
return buildDiscard
}
func (buildDiscard *BuildDiscardCommand) SetDiscardBuildsParams(params services.DiscardBuildsParams) *BuildDiscardCommand {
buildDiscard.DiscardBuildsParams = params
return buildDiscard
}
func (buildDiscard *BuildDiscardCommand) Run() error {
servicesManager, err := utils.CreateServiceManager(buildDiscard.rtDetails, false)
if err != nil {
return err
}
return servicesManager.DiscardBuilds(buildDiscard.DiscardBuildsParams)
}
func (buildDiscard *BuildDiscardCommand) RtDetails() (*config.ArtifactoryDetails, error) {
return buildDiscard.rtDetails, nil
}
func (buildDiscard *BuildDiscardCommand) CommandName() string {
return "rt_build_discard"
}