本文整理汇总了Golang中github.com/jfrogdev/jfrog-cli-go/utils/config.BintrayDetails类的典型用法代码示例。如果您正苦于以下问题:Golang BintrayDetails类的具体用法?Golang BintrayDetails怎么用?Golang BintrayDetails使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BintrayDetails类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: Config
func Config(details, defaultDetails *config.BintrayDetails, interactive bool) (*config.BintrayDetails, error) {
if details == nil {
details = new(config.BintrayDetails)
}
if interactive {
if defaultDetails == nil {
var err error
defaultDetails, err = config.ReadBintrayConf()
if err != nil {
return nil, err
}
}
if details.User == "" {
ioutils.ScanFromConsole("User", &details.User, defaultDetails.User)
}
if details.Key == "" {
print("Key: ")
byteKey, err := terminal.ReadPassword(int(syscall.Stdin))
err = cliutils.CheckError(err)
if err != nil {
return nil, err
}
details.Key = string(byteKey)
if details.Key == "" {
details.Key = defaultDetails.Key
}
}
if details.DefPackageLicenses == "" {
ioutils.ScanFromConsole("\nDefault package licenses",
&details.DefPackageLicenses, defaultDetails.DefPackageLicenses)
}
}
config.SaveBintrayConf(details)
return details, nil
}
示例2: ShowVersion
func ShowVersion(versionDetails *utils.VersionDetails, bintrayDetails *config.BintrayDetails) error {
if bintrayDetails.User == "" {
bintrayDetails.User = versionDetails.Subject
}
version := versionDetails.Version
if versionDetails.Version == "" {
versionDetails.Version = "_latest"
version = "latest"
}
url := bintrayDetails.ApiUrl + "packages/" + versionDetails.Subject + "/" +
versionDetails.Repo + "/" + versionDetails.Package + "/versions/" + versionDetails.Version
log.Info("Getting version details...")
httpClientsDetails := utils.GetBintrayHttpClientDetails(bintrayDetails)
resp, body, _, _ := ioutils.SendGet(url, true, httpClientsDetails)
if resp.StatusCode != 200 {
return cliutils.CheckError(errors.New("Bintray response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Bintray response:", resp.Status)
log.Info("Version", version, "details:")
fmt.Println(cliutils.IndentJson(body))
return nil
}
示例3: GpgSignFile
func GpgSignFile(pathDetails *utils.PathDetails, passphrase string, bintrayDetails *config.BintrayDetails) error {
if bintrayDetails.User == "" {
bintrayDetails.User = pathDetails.Subject
}
url := bintrayDetails.ApiUrl + "gpg/" + pathDetails.Subject + "/" +
pathDetails.Repo + "/" + pathDetails.Path
var data string
if passphrase != "" {
data = "{ \"passphrase\": \"" + passphrase + "\" }"
}
log.Info("GPG signing file...")
httpClientsDetails := utils.GetBintrayHttpClientDetails(bintrayDetails)
resp, body, err := ioutils.SendPost(url, []byte(data), httpClientsDetails)
if err != nil {
return err
}
if resp.StatusCode != 200 {
return cliutils.CheckError(errors.New("Bintray response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Bintray response:", resp.Status)
log.Info("GPG signed file", pathDetails.Path, ", details:")
fmt.Println(cliutils.IndentJson(body))
return nil
}
示例4: doCreateVersion
func doCreateVersion(versionDetails *utils.VersionDetails, flags *utils.VersionFlags, bintrayDetails *config.BintrayDetails) (*http.Response, []byte, error) {
if bintrayDetails.User == "" {
bintrayDetails.User = versionDetails.Subject
}
var data string
if flags != nil {
data = utils.CreateVersionJson(versionDetails.Version, flags)
} else {
m := map[string]string{
"name": versionDetails.Version}
data = cliutils.MapToJson(m)
}
url := bintrayDetails.ApiUrl + "packages/" + versionDetails.Subject + "/" +
versionDetails.Repo + "/" + versionDetails.Package + "/versions"
httpClientsDetails := utils.GetBintrayHttpClientDetails(bintrayDetails)
return ioutils.SendPost(url, []byte(data), httpClientsDetails)
}
示例5: ShowPackage
func ShowPackage(packageDetails *utils.VersionDetails, bintrayDetails *config.BintrayDetails) (err error) {
if bintrayDetails.User == "" {
bintrayDetails.User = packageDetails.Subject
}
url := bintrayDetails.ApiUrl + "packages/" + packageDetails.Subject + "/" +
packageDetails.Repo + "/" + packageDetails.Package
log.Info("Getting package details...")
httpClientsDetails := utils.GetBintrayHttpClientDetails(bintrayDetails)
resp, body, _, _ := ioutils.SendGet(url, true, httpClientsDetails)
if resp.StatusCode != 200 {
return cliutils.CheckError(errors.New("Bintray response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Bintray response:", resp.Status)
log.Info("Package", packageDetails.Package, "details:")
fmt.Println(cliutils.IndentJson(body))
return
}
示例6: LogsList
func LogsList(packageDetails *utils.VersionDetails, details *config.BintrayDetails) error {
if details.User == "" {
details.User = packageDetails.Subject
}
path := details.ApiUrl + "packages/" + packageDetails.Subject + "/" +
packageDetails.Repo + "/" + packageDetails.Package + "/logs/"
httpClientsDetails := utils.GetBintrayHttpClientDetails(details)
log.Info("Getting logs...")
resp, body, _, _ := ioutils.SendGet(path, true, httpClientsDetails)
if resp.StatusCode != 200 {
return cliutils.CheckError(errors.New("Bintray response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Bintray response:", resp.Status)
log.Info("Log details:")
fmt.Println(cliutils.IndentJson(body))
return nil
}
示例7: DownloadLog
func DownloadLog(packageDetails *utils.VersionDetails, logName string,
details *config.BintrayDetails) error {
if details.User == "" {
details.User = packageDetails.Subject
}
path := details.ApiUrl + "packages/" + packageDetails.Subject + "/" +
packageDetails.Repo + "/" + packageDetails.Package + "/logs/" + logName
httpClientsDetails := utils.GetBintrayHttpClientDetails(details)
log.Info("Downloading logs...")
resp, err := ioutils.DownloadFile(path, "", logName, httpClientsDetails)
if err != nil {
return err
}
if resp.StatusCode != 200 {
return cliutils.CheckError(errors.New("Bintray response: " + resp.Status))
}
log.Debug("Bintray response:", resp.Status)
log.Info("Downloaded log.")
return nil
}
示例8: ShowEntitlements
func ShowEntitlements(bintrayDetails *config.BintrayDetails, details *utils.VersionDetails) error {
url := BuildEntitlementsUrl(bintrayDetails, details)
if bintrayDetails.User == "" {
bintrayDetails.User = details.Subject
}
httpClientsDetails := utils.GetBintrayHttpClientDetails(bintrayDetails)
log.Info("Getting entitlements...")
resp, body, _, err := ioutils.SendGet(url, true, httpClientsDetails)
if err != nil {
return err
}
if resp.StatusCode != 200 {
return cliutils.CheckError(errors.New("Bintray response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Bintray response:", resp.Status)
log.Info("Entitlements details:")
fmt.Println(cliutils.IndentJson(body))
return nil
}
示例9: DeleteVersion
func DeleteVersion(versionDetails *utils.VersionDetails, bintrayDetails *config.BintrayDetails) error {
if bintrayDetails.User == "" {
bintrayDetails.User = versionDetails.Subject
}
url := bintrayDetails.ApiUrl + "packages/" + versionDetails.Subject + "/" +
versionDetails.Repo + "/" + versionDetails.Package + "/versions/" + versionDetails.Version
log.Info("Deleting version...")
httpClientsDetails := utils.GetBintrayHttpClientDetails(bintrayDetails)
resp, body, err := ioutils.SendDelete(url, nil, httpClientsDetails)
if err != nil {
return err
}
if resp.StatusCode != 200 {
return cliutils.CheckError(errors.New("Bintray response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Bintray response:", resp.Status)
log.Info("Deleted version", versionDetails.Version+".")
return nil
}
示例10: PublishVersion
func PublishVersion(versionDetails *utils.VersionDetails, bintrayDetails *config.BintrayDetails) error {
if bintrayDetails.User == "" {
bintrayDetails.User = versionDetails.Subject
}
url := bintrayDetails.ApiUrl + "content/" + versionDetails.Subject + "/" +
versionDetails.Repo + "/" + versionDetails.Package + "/" +
versionDetails.Version + "/publish"
log.Info("Publishing version...")
httpClientsDetails := utils.GetBintrayHttpClientDetails(bintrayDetails)
resp, body, err := ioutils.SendPost(url, nil, httpClientsDetails)
if err != nil {
return err
}
if resp.StatusCode != 200 {
return cliutils.CheckError(errors.New("Bintray response: " + resp.Status + "\n" + cliutils.IndentJson(body)))
}
log.Debug("Bintray response:", resp.Status)
log.Info("Published version", versionDetails.Version+", details:")
fmt.Println(cliutils.IndentJson(body))
return nil
}