-
Notifications
You must be signed in to change notification settings - Fork 58
/
signBundle.go
43 lines (34 loc) · 1.11 KB
/
signBundle.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
43
package distribution
import (
"github.com/jfrog/jfrog-cli-core/artifactory/utils"
"github.com/jfrog/jfrog-cli-core/utils/config"
"github.com/jfrog/jfrog-client-go/distribution/services"
)
type SignBundleCommand struct {
serverDetails *config.ServerDetails
signBundlesParams services.SignBundleParams
}
func NewReleaseBundleSignCommand() *SignBundleCommand {
return &SignBundleCommand{}
}
func (sb *SignBundleCommand) SetServerDetails(serverDetails *config.ServerDetails) *SignBundleCommand {
sb.serverDetails = serverDetails
return sb
}
func (sb *SignBundleCommand) SetReleaseBundleSignParams(params services.SignBundleParams) *SignBundleCommand {
sb.signBundlesParams = params
return sb
}
func (sb *SignBundleCommand) Run() error {
servicesManager, err := utils.CreateDistributionServiceManager(sb.serverDetails, false)
if err != nil {
return err
}
return servicesManager.SignReleaseBundle(sb.signBundlesParams)
}
func (sb *SignBundleCommand) ServerDetails() (*config.ServerDetails, error) {
return sb.serverDetails, nil
}
func (sb *SignBundleCommand) CommandName() string {
return "rt_sign_bundle"
}