Skip to content

Commit

Permalink
chore: update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
moooofly committed Jun 22, 2018
1 parent 25be99a commit 3b18281
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 30 deletions.
6 changes: 3 additions & 3 deletions api/configurations.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions api/loginout.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 == "" {
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion api/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand Down
8 changes: 4 additions & 4 deletions api/projects.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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 +
Expand Down
6 changes: 3 additions & 3 deletions api/repositories.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 +
Expand All @@ -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)
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion api/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion api/statistic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions api/systeminfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions api/tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
16 changes: 8 additions & 8 deletions api/targets.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 3 additions & 1 deletion api/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 3b18281

Please sign in to comment.