-
Notifications
You must be signed in to change notification settings - Fork 55
/
signBundle.go
68 lines (55 loc) · 1.74 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package commands
import (
"github.com/jfrog/jfrog-cli-core/v2/artifactory/utils"
"github.com/jfrog/jfrog-cli-core/v2/utils/config"
"github.com/jfrog/jfrog-client-go/distribution/services"
clientutils "github.com/jfrog/jfrog-client-go/utils"
)
type SignBundleCommand struct {
serverDetails *config.ServerDetails
signBundlesParams services.SignBundleParams
detailedSummary bool
summary *clientutils.Sha256Summary
}
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
}
summary, err := servicesManager.SignReleaseBundle(sb.signBundlesParams)
if sb.detailedSummary {
sb.summary = summary
}
return err
}
func (sb *SignBundleCommand) ServerDetails() (*config.ServerDetails, error) {
return sb.serverDetails, nil
}
func (sb *SignBundleCommand) CommandName() string {
return "rt_sign_bundle"
}
func (sb *SignBundleCommand) SetSummary(summary *clientutils.Sha256Summary) *SignBundleCommand {
sb.summary = summary
return sb
}
func (sb *SignBundleCommand) GetSummary() *clientutils.Sha256Summary {
return sb.summary
}
func (sb *SignBundleCommand) SetDetailedSummary(detailedSummary bool) *SignBundleCommand {
sb.detailedSummary = detailedSummary
return sb
}
func (sb *SignBundleCommand) IsDetailedSummary() bool {
return sb.detailedSummary
}