Unverified Commit 5abd33d5 authored by Sander van Harmelen's avatar Sander van Harmelen Committed by GitHub

Make some small semantic changes (#318)

parent b1cfdff1
......@@ -43,10 +43,10 @@ type Runner struct {
Status string `json:"status"`
}
// RunnersDetails represents a GitLab CI RunnerDetails.
// RunnerDetails represents the GitLab CI runner details.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/runners.html
type RunnersDetails struct {
type RunnerDetails struct {
Active bool `json:"active"`
Architecture string `json:"architecture"`
Description string `json:"description"`
......@@ -123,7 +123,7 @@ func (s *RunnersService) ListAllRunners(opt *ListRunnersOptions, options ...Opti
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#get-runner-39-s-details
func (s *RunnersService) GetRunnerDetails(rid interface{}, options ...OptionFunc) (*RunnersDetails, *Response, error) {
func (s *RunnersService) GetRunnerDetails(rid interface{}, options ...OptionFunc) (*RunnerDetails, *Response, error) {
runner, err := parseID(rid)
if err != nil {
return nil, nil, err
......@@ -135,7 +135,7 @@ func (s *RunnersService) GetRunnerDetails(rid interface{}, options ...OptionFunc
return nil, nil, err
}
var rs *RunnersDetails
var rs *RunnerDetails
resp, err := s.client.Do(req, &rs)
if err != nil {
return nil, resp, err
......@@ -144,11 +144,11 @@ func (s *RunnersService) GetRunnerDetails(rid interface{}, options ...OptionFunc
return rs, resp, err
}
// UpdateRunnersDetailsOptions represents the available UpdateRunnersDetails() options.
// UpdateRunnerDetailsOptions represents the available UpdateRunnerDetails() options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#update-runner-39-s-details
type UpdateRunnersDetailsOptions struct {
type UpdateRunnerDetailsOptions struct {
Description *string `url:"description,omitempty" json:"description,omitempty"`
Active *bool `url:"active,omitempty" json:"active,omitempty"`
TagList []string `url:"tag_list[],omitempty" json:"tag_list,omitempty"`
......@@ -157,11 +157,11 @@ type UpdateRunnersDetailsOptions struct {
AccessLevel *string `url:"access_level,omitempty" json:"access_level,omitempty"`
}
// UpdateRunnersDetails updates runners details
// UpdateRunnerDetails updates details for a given runner.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#update-runner-39-s-details
func (s *RunnersService) UpdateRunnersDetails(rid interface{}, opt *UpdateRunnersDetailsOptions, options ...OptionFunc) (*RunnersDetails, *Response, error) {
func (s *RunnersService) UpdateRunnerDetails(rid interface{}, opt *UpdateRunnerDetailsOptions, options ...OptionFunc) (*RunnerDetails, *Response, error) {
runner, err := parseID(rid)
if err != nil {
return nil, nil, err
......@@ -173,7 +173,7 @@ func (s *RunnersService) UpdateRunnersDetails(rid interface{}, opt *UpdateRunner
return nil, nil, err
}
var rs *RunnersDetails
var rs *RunnerDetails
resp, err := s.client.Do(req, &rs)
if err != nil {
return nil, resp, err
......@@ -182,11 +182,11 @@ func (s *RunnersService) UpdateRunnersDetails(rid interface{}, opt *UpdateRunner
return rs, resp, err
}
// RemoveARunner removes a runner
// RemoveRunner removes a runner.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#remove-a-runner
func (s *RunnersService) RemoveARunner(rid interface{}, options ...OptionFunc) (*Response, error) {
func (s *RunnersService) RemoveRunner(rid interface{}, options ...OptionFunc) (*Response, error) {
runner, err := parseID(rid)
if err != nil {
return nil, err
......@@ -201,21 +201,21 @@ func (s *RunnersService) RemoveARunner(rid interface{}, options ...OptionFunc) (
return s.client.Do(req, nil)
}
// ListRunnersJobsOptions represents the available ListRunnersJobs()
// options. (one of running, success, failed, canceled)
// ListRunnerJobsOptions represents the available ListRunnerJobs()
// options. Status can be one of: running, success, failed, canceled.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#list-runner-39-s-jobs
type ListRunnersJobsOptions struct {
type ListRunnerJobsOptions struct {
ListOptions
Status *BuildState `url:"status,omitempty" json:"status,omitempty"`
Status *string `url:"status,omitempty" json:"status,omitempty"`
}
// ListRunnerJobs gets a list of jobs that are being processed or were processed by specified Runner.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#list-runner-39-s-jobs
func (s *RunnersService) ListRunnerJobs(rid interface{}, opt *ListRunnersJobsOptions, options ...OptionFunc) ([]*Job, *Response, error) {
func (s *RunnersService) ListRunnerJobs(rid interface{}, opt *ListRunnerJobsOptions, options ...OptionFunc) ([]*Job, *Response, error) {
runner, err := parseID(rid)
if err != nil {
return nil, nil, err
......@@ -311,12 +311,10 @@ func (s *RunnersService) DisableProjectRunner(pid interface{}, rid interface{},
if err != nil {
return nil, err
}
runner, err := parseID(rid)
if err != nil {
return nil, err
}
u := fmt.Sprintf("projects/%s/runners/%s", url.QueryEscape(project), url.QueryEscape(runner))
req, err := s.client.NewRequest("DELETE", u, nil, options)
......
......@@ -48,7 +48,7 @@ func TestListRunnersJobs(t *testing.T) {
fmt.Fprint(w, `[{"id":1},{"id":2}]`)
})
opt := &ListRunnersJobsOptions{}
opt := &ListRunnerJobsOptions{}
jobs, _, err := client.Runners.ListRunnerJobs(1, opt)
if err != nil {
......@@ -70,7 +70,7 @@ func TestRemoveRunner(t *testing.T) {
w.WriteHeader(http.StatusNoContent)
})
_, err := client.Runners.RemoveARunner(1, nil)
_, err := client.Runners.RemoveRunner(1, nil)
if err != nil {
t.Fatalf("Runners.RemoveARunner returns an error: %v", err)
}
......@@ -115,9 +115,9 @@ func TestUpdateRunnersDetails(t *testing.T) {
fmt.Fprint(w, exampleDetailRsp)
})
opt := &UpdateRunnersDetailsOptions{}
opt := &UpdateRunnerDetailsOptions{}
details, _, err := client.Runners.UpdateRunnersDetails(6, opt, nil)
details, _, err := client.Runners.UpdateRunnerDetails(6, opt, nil)
if err != nil {
t.Fatalf("Runners.UpdateRunnersDetails returns an error: %v", err)
}
......@@ -149,7 +149,7 @@ func TestGetRunnerDetails(t *testing.T) {
}
// helper function returning expected result for string: &exampleDetailRsp
func expectedParsedDetails() *RunnersDetails {
func expectedParsedDetails() *RunnerDetails {
proj := struct {
ID int `json:"id"`
Name string `json:"name"`
......@@ -158,7 +158,7 @@ func expectedParsedDetails() *RunnersDetails {
PathWithNamespace string `json:"path_with_namespace"`
}{ID: 1, Name: "GitLab Community Edition", NameWithNamespace: "GitLab.org / GitLab Community Edition", Path: "gitlab-ce", PathWithNamespace: "gitlab-org/gitlab-ce"}
timestamp, _ := time.Parse("2006-01-02T15:04:05.000Z", "2016-01-25T16:39:48.066Z")
return &RunnersDetails{Active: true, Description: "test-1-20150125-test", ID: 6, IsShared: false, ContactedAt: &timestamp, Online: true, Status: "online", Token: "205086a8e3b9a2b818ffac9b89d102", TagList: []string{"ruby", "mysql"}, AccessLevel: "ref_protected", Projects: []struct {
return &RunnerDetails{Active: true, Description: "test-1-20150125-test", ID: 6, IsShared: false, ContactedAt: &timestamp, Online: true, Status: "online", Token: "205086a8e3b9a2b818ffac9b89d102", TagList: []string{"ruby", "mysql"}, AccessLevel: "ref_protected", Projects: []struct {
ID int `json:"id"`
Name string `json:"name"`
NameWithNamespace string `json:"name_with_namespace"`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment