Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
go-gitlab
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
go-gitlab
Commits
be89dfe8
Commit
be89dfe8
authored
Jan 29, 2018
by
Sander van Harmelen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tweak the new runners service just a bit (docs mostly)
parent
a7df0f3a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
18 deletions
+30
-18
runners.go
runners.go
+30
-18
No files found.
runners.go
View file @
be89dfe8
...
@@ -44,7 +44,8 @@ type Runner struct {
...
@@ -44,7 +44,8 @@ type Runner struct {
// ListRunnersOptions represents the available ListRunners() options.
// ListRunnersOptions represents the available ListRunners() options.
//
//
// GitLab API docs: https://docs.gitlab.com/ce/api/runners.html
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#list-owned-runners
type
ListRunnersOptions
struct
{
type
ListRunnersOptions
struct
{
ListOptions
ListOptions
Scope
*
string
`url:"scope,omitempty" json:"scope,omitempty"`
Scope
*
string
`url:"scope,omitempty" json:"scope,omitempty"`
...
@@ -52,45 +53,55 @@ type ListRunnersOptions struct {
...
@@ -52,45 +53,55 @@ type ListRunnersOptions struct {
// ListRunners gets a list of runners accessible by the authenticated user.
// ListRunners gets a list of runners accessible by the authenticated user.
//
//
// GitLab API docs: https://docs.gitlab.com/ce/api/runners.html
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#list-owned-runners
func
(
s
*
RunnersService
)
ListRunners
(
opt
*
ListRunnersOptions
,
options
...
OptionFunc
)
([]
*
Runner
,
*
Response
,
error
)
{
func
(
s
*
RunnersService
)
ListRunners
(
opt
*
ListRunnersOptions
,
options
...
OptionFunc
)
([]
*
Runner
,
*
Response
,
error
)
{
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
"runners"
,
opt
,
options
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
"runners"
,
opt
,
options
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
var
p
[]
*
Runner
var
rs
[]
*
Runner
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
p
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
rs
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
resp
,
err
return
nil
,
resp
,
err
}
}
return
p
,
resp
,
err
return
rs
,
resp
,
err
}
}
// ListAllRunners gets a list of all runners in the GitLab instance. Access is
// ListAllRunners gets a list of all runners in the GitLab instance. Access is
// restricted to users with admin privileges.
// restricted to users with admin privileges.
//
//
// GitLab API docs: https://docs.gitlab.com/ce/api/runners.html
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#list-all-runners
func
(
s
*
RunnersService
)
ListAllRunners
(
opt
*
ListRunnersOptions
,
options
...
OptionFunc
)
([]
*
Runner
,
*
Response
,
error
)
{
func
(
s
*
RunnersService
)
ListAllRunners
(
opt
*
ListRunnersOptions
,
options
...
OptionFunc
)
([]
*
Runner
,
*
Response
,
error
)
{
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
"runners/all"
,
opt
,
options
)
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
"runners/all"
,
opt
,
options
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
var
p
[]
*
Runner
var
rs
[]
*
Runner
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
p
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
rs
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
resp
,
err
return
nil
,
resp
,
err
}
}
return
p
,
resp
,
err
return
rs
,
resp
,
err
}
}
// ListProjectRunnersOptions represents the available ListProjectRunners()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#list-project-s-runners
type
ListProjectRunnersOptions
ListRunnersOptions
// ListProjectRunners gets a list of runners accessible by the authenticated user.
// ListProjectRunners gets a list of runners accessible by the authenticated user.
//
//
// GitLab API docs: https://docs.gitlab.com/ce/api/runners.html
// GitLab API docs:
func
(
s
*
RunnersService
)
ListProjectRunners
(
pid
interface
{},
opt
*
ListRunnersOptions
,
options
...
OptionFunc
)
([]
*
Runner
,
*
Response
,
error
)
{
// https://docs.gitlab.com/ce/api/runners.html#list-project-s-runners
func
(
s
*
RunnersService
)
ListProjectRunners
(
pid
interface
{},
opt
*
ListProjectRunnersOptions
,
options
...
OptionFunc
)
([]
*
Runner
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
nil
,
err
...
@@ -102,13 +113,13 @@ func (s *RunnersService) ListProjectRunners(pid interface{}, opt *ListRunnersOpt
...
@@ -102,13 +113,13 @@ func (s *RunnersService) ListProjectRunners(pid interface{}, opt *ListRunnersOpt
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
var
p
[]
*
Runner
var
rs
[]
*
Runner
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
p
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
rs
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
resp
,
err
return
nil
,
resp
,
err
}
}
return
p
,
resp
,
err
return
rs
,
resp
,
err
}
}
// EnableProjectRunnerOptions represents the available EnableProjectRunner()
// EnableProjectRunnerOptions represents the available EnableProjectRunner()
...
@@ -122,7 +133,8 @@ type EnableProjectRunnerOptions struct {
...
@@ -122,7 +133,8 @@ type EnableProjectRunnerOptions struct {
// EnableProjectRunner enables an available specific runner in the project.
// EnableProjectRunner enables an available specific runner in the project.
//
//
// GitLab API docs: https://docs.gitlab.com/ce/api/runners.html
// GitLab API docs:
// https://docs.gitlab.com/ce/api/runners.html#enable-a-runner-in-project
func
(
s
*
RunnersService
)
EnableProjectRunner
(
pid
interface
{},
opt
*
EnableProjectRunnerOptions
,
options
...
OptionFunc
)
(
*
Runner
,
*
Response
,
error
)
{
func
(
s
*
RunnersService
)
EnableProjectRunner
(
pid
interface
{},
opt
*
EnableProjectRunnerOptions
,
options
...
OptionFunc
)
(
*
Runner
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -135,11 +147,11 @@ func (s *RunnersService) EnableProjectRunner(pid interface{}, opt *EnableProject
...
@@ -135,11 +147,11 @@ func (s *RunnersService) EnableProjectRunner(pid interface{}, opt *EnableProject
return
nil
,
nil
,
err
return
nil
,
nil
,
err
}
}
var
p
*
Runner
var
r
*
Runner
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
p
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
&
r
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
resp
,
err
return
nil
,
resp
,
err
}
}
return
p
,
resp
,
err
return
r
,
resp
,
err
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment