diff --git a/api/configurations.go b/api/configurations.go index d651201..a012624 100644 --- a/api/configurations.go +++ b/api/configurations.go @@ -54,7 +54,7 @@ func (x *sysConfigReset) Execute(args []string) error { // GetSysConfig is for retrieving system configurations that only provides for admin user. // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/configurations' +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/configurations' func GetSysConfig(baseURL string) { targetURL := baseURL fmt.Println("==> GET", targetURL) @@ -99,7 +99,7 @@ func GetSysConfig(baseURL string) { "daily_time": 0 } } -}' 'https://11.11.11.12/api/configurations' +}' 'https://localhost/api/configurations' */ func PutSysConfigCreate(baseURL string) { targetURL := baseURL @@ -131,7 +131,7 @@ func PutSysConfigCreate(baseURL string) { // PostSysConfigReset resets system configurations from environment variables. Can only be accessed by admin user. // -// e.g. curl -X POST --header 'Content-Type: application/json' --header 'Accept: text/plain' 'https://11.11.11.12/api/configurations/reset' +// e.g. curl -X POST --header 'Content-Type: application/json' --header 'Accept: text/plain' 'https://localhost/api/configurations/reset' func PostSysConfigReset(baseURL string) { targetURL := baseURL fmt.Println("==> POST", targetURL) diff --git a/api/loginout.go b/api/loginout.go index 790b5f8..85683dc 100644 --- a/api/loginout.go +++ b/api/loginout.go @@ -45,7 +45,7 @@ func (x *logout) Execute(args []string) error { // username - Current login username. // password - Current login password. // -// e.g. curl -X POST --header 'Content-Type: application/x-www-form-urlencoded;param=value' 'https://11.11.11.12/login' -i -k -d "principal=admin&password=Harbor12345" +// e.g. curl -X POST --header 'Content-Type: application/x-www-form-urlencoded;param=value' 'https://localhost/login' -i -k -d "principal=admin&password=Harbor12345" func LoginHarbor(baseURL string) { if li.Password == "" { @@ -91,7 +91,7 @@ func LoginHarbor(baseURL string) { // // params: // -// e.g. curl -X GET 'https://11.11.11.12/log_out' -i -k +// e.g. curl -X GET 'https://localhost/log_out' -i -k func LogoutHarbor(baseURL string) { targetURL := baseURL fmt.Println("==> GET", targetURL) diff --git a/api/logs.go b/api/logs.go index 2731b4b..44b988d 100644 --- a/api/logs.go +++ b/api/logs.go @@ -34,7 +34,7 @@ func (x *recentLogs) Execute(args []string) error { // GetOPLogs ... // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/logs?username=admin&repository=prj2%2Fphoton&tag=v3&operation=push&begin_timestamp=20171102&page=1&page_size=10' +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/logs?username=admin&repository=prj2%2Fphoton&tag=v3&operation=push&begin_timestamp=20171102&page=1&page_size=10' func GetOPLogs(baseURL string) { targetURL := baseURL + "?username=" + logs.Username + "&repository=" + logs.Repository + diff --git a/api/projects.go b/api/projects.go index 5827738..41e9dc7 100644 --- a/api/projects.go +++ b/api/projects.go @@ -106,7 +106,7 @@ curl -X POST --header 'Content-Type: text/plain' --header 'Accept: text/plain' - "prevent_vulnerable_images_from_running": false, "prevent_vulnerable_images_from_running_severity": "", "automatically_scan_images_on_push": false -}' 'https://11.11.11.12/api/projects' +}' 'https://localhost/api/projects' */ func PostPrjCreate(baseURL string) { targetURL := baseURL @@ -136,7 +136,7 @@ func PostPrjCreate(baseURL string) { // params: // project_id - (REQUIRED) Project ID of project which will be get. // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/projects/100' +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/projects/100' func GetPrjByPrjID(baseURL string) { targetURL := baseURL + "/" + strconv.Itoa(prjGet.ProjectID) fmt.Println("==> GET", targetURL) @@ -158,7 +158,7 @@ func GetPrjByPrjID(baseURL string) { // params: // project_id - (REQUIRED) Project ID of project which will be deleted. // -// e.g. curl -X DELETE --header 'Accept: text/plain' 'https://11.11.11.12/api/projects/100' +// e.g. curl -X DELETE --header 'Accept: text/plain' 'https://localhost/api/projects/100' func DelPrjByPrjID(baseURL string) { targetURL := baseURL + "/" + strconv.Itoa(prjDel.ProjectID) fmt.Println("==> DELETE", targetURL) @@ -184,7 +184,7 @@ func DelPrjByPrjID(baseURL string) { // page - The page nubmer, default is 1. // page_size - The size of per page, default is 10, maximum is 100. // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/projects?name=prj&public=true&owner=moooofly&page=1&page_size=10' +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/projects?name=prj&public=true&owner=moooofly&page=1&page_size=10' func GetPrjsList(baseURL string) { targetURL := baseURL + "?name=" + prjsList.Name + "&public=" + prjsList.Public + diff --git a/api/repositories.go b/api/repositories.go index 453786a..8bd63ec 100644 --- a/api/repositories.go +++ b/api/repositories.go @@ -66,7 +66,7 @@ func (x *repositoryDel) Execute(args []string) error { // page - The page nubmer, default is 1. // pageSize - The size of per page, default is 10, maximum is 100. // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/repositories?project_id=1&q=prj&page=1&page_size=10' +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/repositories?project_id=1&q=prj&page=1&page_size=10' func GetReposByPrjID(baseURL string) { targetURL := baseURL + "?project_id=" + strconv.Itoa(reposList.ProjectID) + "&q=" + reposList.RepoName + @@ -91,7 +91,7 @@ func GetReposByPrjID(baseURL string) { // params: // count - The number of the requested public repositories, default is 10 if not provided. // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/repositories/top?count=3' +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/repositories/top?count=3' func GetTopRepos(baseURL string) { targetURL := baseURL + "?count=" + strconv.Itoa(reposTop.Count) fmt.Println("==> GET", targetURL) @@ -104,7 +104,7 @@ func GetTopRepos(baseURL string) { // params: // repo_name - (REQUIRED) The name of repository which will be deleted. // -// e.g. curl -X DELETE --header 'Accept: text/plain' 'https://11.11.11.12/api/repositories/prj1%2Fhello-world' +// e.g. curl -X DELETE --header 'Accept: text/plain' 'https://localhost/api/repositories/prj1%2Fhello-world' func DelRepoByRepoName(baseURL string) { targetURL := baseURL + "/" + repodel.RepoName fmt.Println("==> DELETE", targetURL) diff --git a/api/search.go b/api/search.go index f75434f..df7892c 100644 --- a/api/search.go +++ b/api/search.go @@ -26,7 +26,7 @@ func (x *search) Execute(args []string) error { // SearchPrjAndRepo returns information about the projects and repositories offered at public status or related to the current logged in user. The response includes the project and repository list in a proper display order. // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/search?q=hello-world' +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/search?q=hello-world' func SearchPrjAndRepo(baseURL string) { targetURL := baseURL + "?q=" + searching.Q fmt.Println("==> GET", targetURL) diff --git a/api/statistic.go b/api/statistic.go index 74e924b..32e49b6 100644 --- a/api/statistic.go +++ b/api/statistic.go @@ -25,7 +25,7 @@ func (x *statistics) Execute(args []string) error { // GetStats is aimed to statistic all of the projects number and repositories number relevant to the logined user, also the public projects number and repositories number. If the user is admin, he can also get total projects number and total repositories number. // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/statistics' +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/statistics' func GetStats(baseURL string) { targetURL := baseURL fmt.Println("==> GET", targetURL) diff --git a/api/systeminfo.go b/api/systeminfo.go index 2b71ec2..d527003 100644 --- a/api/systeminfo.go +++ b/api/systeminfo.go @@ -53,7 +53,7 @@ func (x *sysInfoRootCert) Execute(args []string) error { // GetSysGeneral is for retrieving general system info, this can be called by anonymous request. // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/systeminfo' +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/systeminfo' func GetSysGeneral(baseURL string) { targetURL := baseURL fmt.Println("==> GET", targetURL) @@ -65,7 +65,7 @@ func GetSysGeneral(baseURL string) { // GetSysVolumes is for retrieving system volume info that only provides for admin user. // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/systeminfo/volumes' +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/systeminfo/volumes' func GetSysVolumes(baseURL string) { targetURL := baseURL fmt.Println("==> GET", targetURL) @@ -83,7 +83,7 @@ func GetSysVolumes(baseURL string) { // GetSysRootCert is for downloading a default root certificate that only provides for admin user under OVA deployment. // -// e.g. curl -X GET --header 'Accept: text/plain' 'https://11.11.11.12/api/systeminfo/getcert' +// e.g. curl -X GET --header 'Accept: text/plain' 'https://localhost/api/systeminfo/getcert' func GetSysRootCert(baseURL string) { targetURL := baseURL fmt.Println("==> GET", targetURL) diff --git a/api/tags.go b/api/tags.go index 468d20b..a6058e3 100644 --- a/api/tags.go +++ b/api/tags.go @@ -63,7 +63,7 @@ func (x *tagsList) Execute(args []string) error { // repo_name - (REQUIRED) Relevant repository name. // tag - (REQUIRED) Tag of the repository. // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/repositories/prj2%2Fphoton/tags/v2' +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/repositories/prj2%2Fphoton/tags/v2' func GetTaginfoOfRepo(baseURL string) { targetURL := baseURL + "/" + tagget.RepoName + "/tags/" + tagget.Tag fmt.Println("==> GET", targetURL) @@ -86,7 +86,7 @@ func GetTaginfoOfRepo(baseURL string) { // repo_name - (REQUIRED) The name of repository which will be deleted. // tag - (REQUIRED) Tag of a repository. // -// e.g. curl -X DELETE --header 'Accept: text/plain' 'https://11.11.11.12/api/repositories/prj2%2Fphoton/tags/v2' +// e.g. curl -X DELETE --header 'Accept: text/plain' 'https://localhost/api/repositories/prj2%2Fphoton/tags/v2' func DelTaginfoOfRepo(baseURL string) { targetURL := baseURL + "/" + tagdel.RepoName + "/tags/" + tagdel.Tag fmt.Println("==> DELETE", targetURL) @@ -108,7 +108,7 @@ func DelTaginfoOfRepo(baseURL string) { // params: // repo_name - (REQUIRED) Relevant repository name. // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/repositories/prj2%2Fphoton/tags' +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/repositories/prj2%2Fphoton/tags' func GetTagsByRepoName(baseURL string) { targetURL := baseURL + "/" + tagslist.RepoName + "/tags" fmt.Println("==> GET", targetURL) diff --git a/api/targets.go b/api/targets.go index 01ccc03..9d8392e 100644 --- a/api/targets.go +++ b/api/targets.go @@ -148,7 +148,7 @@ func (x *targetsPoliciesByID) Execute(args []string) error { // params: // name - The replication's target name (for filter). // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/targets?name=remote' +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/targets?name=remote' func GetTargetsList(baseURL string) { targetURL := baseURL + "?name=" + tl.Name fmt.Println("==> GET", targetURL) @@ -182,7 +182,7 @@ curl -X POST --header 'Content-Type: text/plain' --header 'Accept: text/plain' - "username": "admin", "password": "Harbor12345", "insecure": true -}' 'https://11.11.11.12/api/targets' +}' 'https://localhost/api/targets' */ func PostTargetsCreate(baseURL string) { targetURL := baseURL @@ -222,7 +222,7 @@ curl -X POST --header 'Content-Type: text/plain' --header 'Accept: text/plain' - "username": "admin", "password": "Harbor12345", "insecure": true -}' 'https://11.11.11.12/api/targets/ping' +}' 'https://localhost/api/targets/ping' */ func PostTargetsPing(baseURL string) { targetURL := baseURL @@ -252,7 +252,7 @@ func PostTargetsPing(baseURL string) { // params: // id - (REQUIRED) The replication's target ID. // -// e.g. curl -X POST --header 'Content-Type: application/json' --header 'Accept: text/plain' 'https://11.11.11.12/api/targets/1/ping' +// e.g. curl -X POST --header 'Content-Type: application/json' --header 'Accept: text/plain' 'https://localhost/api/targets/1/ping' func PostTargetsPingByID(baseURL string) { targetURL := baseURL + "/" + strconv.Itoa(tpingByID.ID) + "/ping" fmt.Println("==> POST", targetURL) @@ -274,7 +274,7 @@ func PostTargetsPingByID(baseURL string) { // params: // id - (REQUIRED) The replication's target ID. // -// e.g. curl -X DELETE --header 'Accept: text/plain' 'https://11.11.11.12/api/targets/2' +// e.g. curl -X DELETE --header 'Accept: text/plain' 'https://localhost/api/targets/2' func DeleteTargetsByID(baseURL string) { targetURL := baseURL + "/" + strconv.Itoa(tdByID.ID) fmt.Println("==> DELETE", targetURL) @@ -296,7 +296,7 @@ func DeleteTargetsByID(baseURL string) { // params: // id - (REQUIRED) The replication's target ID. // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/targets/1' +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/targets/1' func GetTargetsByID(baseURL string) { targetURL := baseURL + "/" + strconv.Itoa(tgByID.ID) fmt.Println("==> GET", targetURL) @@ -331,7 +331,7 @@ curl -X PUT --header 'Content-Type: text/plain' --header 'Accept: text/plain' -d "username": "admin", "password": "12345", "insecure": true -}' 'https://11.11.11.12/api/targets/4' +}' 'https://localhost/api/targets/4' */ func UpdateTargetsByID(baseURL string) { targetURL := baseURL + "/" + strconv.Itoa(tuByID.ID) @@ -363,7 +363,7 @@ func UpdateTargetsByID(baseURL string) { // params: // id - (REQUIRED) The replication's target ID. // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/targets/1/policies/' +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/targets/1/policies/' func GetPoliciesByID(baseURL string) { targetURL := baseURL + "/" + strconv.Itoa(tpoliciesByID.ID) + "/policies/" fmt.Println("==> GET", targetURL) diff --git a/api/users.go b/api/users.go index c78861a..f74d4d6 100644 --- a/api/users.go +++ b/api/users.go @@ -27,7 +27,9 @@ func (x *usersList) Execute(args []string) error { // GetUsers gets the current user information. // -// e.g. curl -X GET --header 'Accept: application/json' 'https://11.11.11.12/api/users/current?api_key=top' +// GET /users/current +// +// e.g. curl -X GET --header 'Accept: application/json' 'https://localhost/api/users/current?api_key=top' func GetUsers(baseURL string) { targetURL := baseURL + "/current" + "?api_key=" + userslist.Apikey fmt.Println("==> GET", targetURL)