forked from jfrog/jfrog-client-go
-
Notifications
You must be signed in to change notification settings - Fork 0
/
go.go
86 lines (69 loc) · 1.77 KB
/
go.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
package _go
import (
"github.com/tenstad/jfrog-client-go/artifactory/services/utils"
"github.com/tenstad/jfrog-client-go/auth"
"github.com/tenstad/jfrog-client-go/http/jfroghttpclient"
)
type GoService struct {
client *jfroghttpclient.JfrogHttpClient
ArtDetails auth.ServiceDetails
}
func NewGoService(client *jfroghttpclient.JfrogHttpClient) *GoService {
return &GoService{client: client}
}
func (gs *GoService) GetJfrogHttpClient() *jfroghttpclient.JfrogHttpClient {
return gs.client
}
func (gs *GoService) SetServiceDetails(artDetails auth.ServiceDetails) {
gs.ArtDetails = artDetails
}
func (gs *GoService) PublishPackage(params GoParams) (*utils.OperationSummary, error) {
artifactoryVersion, err := gs.ArtDetails.GetVersion()
if err != nil {
return nil, err
}
publisher := &GoPublishCommand{}
// PublishPackage supports Artifactory version "6.10.0" and above.
err = publisher.verifyCompatibleVersion(artifactoryVersion)
if err != nil {
return nil, err
}
return publisher.PublishPackage(params, gs.client, gs.ArtDetails)
}
type GoParams struct {
ZipPath string
ModPath string
InfoPath string
ModContent []byte
Version string
Props string
TargetRepo string
ModuleId string
}
func (gp *GoParams) GetZipPath() string {
return gp.ZipPath
}
func (gp *GoParams) GetModContent() []byte {
return gp.ModContent
}
func (gp *GoParams) GetVersion() string {
return gp.Version
}
func (gp *GoParams) GetProps() string {
return gp.Props
}
func (gp *GoParams) GetTargetRepo() string {
return gp.TargetRepo
}
func (gp *GoParams) GetModuleId() string {
return gp.ModuleId
}
func (gp *GoParams) GetModPath() string {
return gp.ModPath
}
func (gp *GoParams) GetInfoPath() string {
return gp.InfoPath
}
func NewGoParams() GoParams {
return GoParams{}
}