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
244bba52
Commit
244bba52
authored
Jan 23, 2018
by
Sander van Harmelen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixup the Jenkins CI service
parent
5c9866cf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
30 deletions
+60
-30
services.go
services.go
+60
-30
No files found.
services.go
View file @
244bba52
...
...
@@ -419,19 +419,66 @@ func (s *ServicesService) DeleteJiraService(pid interface{}, options ...OptionFu
return
s
.
client
.
Do
(
req
,
nil
)
}
// JenkinsCIService represents Jenkins CI service settings.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/services.html#jenkins-ci
type
JenkinsCIService
struct
{
Service
Properties
*
JenkinsCIServiceProperties
`json:"properties"`
}
// JenkinsCIServiceProperties represents Jenkins CI specific properties.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/services.html#jenkins-ci
type
JenkinsCIServiceProperties
struct
{
URL
*
string
`url:"jenkins_url,omitempty" json:"jenkins_url,omitempty"`
ProjectName
*
string
`url:"project_name,omitempty" json:"project_name,omitempty"`
Username
*
string
`url:"username,omitempty" json:"username,omitempty"`
}
// GetJenkinsCIService gets Jenkins CI service settings for a project.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/services.html#get-jenkins-ci-service-settings
func
(
s
*
ServicesService
)
GetJenkinsCIService
(
pid
interface
{},
options
...
OptionFunc
)
(
*
JenkinsCIService
,
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/services/jenkins"
,
url
.
QueryEscape
(
project
))
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
svc
:=
new
(
JenkinsCIService
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
svc
)
if
err
!=
nil
{
return
nil
,
resp
,
err
}
return
svc
,
resp
,
err
}
// SetJenkinsCIServiceOptions represents the available SetJenkinsCIService()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/services.html#jenkins-ci
type
SetJenkinsCIServiceOptions
struct
{
URL
*
string
`url:"jenkins_url
" json:"jenkins_url"
`
ProjectName
*
string
`url:"project_name
" json:"project_name"
`
Username
*
string
`url:"username
" json:"username
"`
Password
*
string
`url:"password
" json:"password
"`
URL
*
string
`url:"jenkins_url
,omitempty" json:"jenkins_url,omitempty"
`
ProjectName
*
string
`url:"project_name
,omitempty" json:"project_name,omitempty"
`
Username
*
string
`url:"username
,omitempty" json:"username,omitempty
"`
Password
*
string
`url:"password
,omitempty" json:"password,omitempty
"`
}
// SetJenkinsCIService sets Jenkins service for a project
//
//
// GitLab API docs:
// https://docs.gitlab.com/ee/api/services.html#create-edit-jenkins-ci-service
func
(
s
*
ServicesService
)
SetJenkinsCIService
(
pid
interface
{},
opt
*
SetJenkinsCIServiceOptions
,
options
...
OptionFunc
)
(
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
...
...
@@ -447,38 +494,21 @@ func (s *ServicesService) SetJenkinsCIService(pid interface{}, opt *SetJenkinsCI
return
s
.
client
.
Do
(
req
,
nil
)
}
// JenkinsCIServiceProperties represents Jenkins CI specific properties.
type
JenkinsCIServiceProperties
struct
{
URL
*
string
`url:"jenkins_url" json:"jenkins_url" `
ProjectName
*
string
`url:"project_name" json:"project_name" `
Username
*
string
`url:"username" json:"username"`
}
// JenkinsCIService represents Jenkins CI service settings.
type
JenkinsCIService
struct
{
Service
Properties
*
JenkinsCIServiceProperties
`json:"properties"`
}
// GetJenkinsCIService gets Jenkins CI service settings for a project.
// DeleteJenkinsCIService deletes Jenkins CI service for project.
//
func
(
s
*
ServicesService
)
GetJenkinsCIService
(
pid
interface
{},
options
...
OptionFunc
)
(
*
JenkinsCIService
,
*
Response
,
error
)
{
// GitLab API docs:
// https://docs.gitlab.com/ce/api/services.html#delete-jira-service
func
(
s
*
ServicesService
)
DeleteJenkinsCIService
(
pid
interface
{},
options
...
OptionFunc
)
(
*
Response
,
error
)
{
project
,
err
:=
parseID
(
pid
)
if
err
!=
nil
{
return
nil
,
nil
,
err
return
nil
,
err
}
u
:=
fmt
.
Sprintf
(
"projects/%s/services/jenkins"
,
url
.
QueryEscape
(
project
))
req
,
err
:=
s
.
client
.
NewRequest
(
"GET"
,
u
,
nil
,
options
)
if
err
!=
nil
{
return
nil
,
nil
,
err
}
opt
:=
new
(
JenkinsCIService
)
resp
,
err
:=
s
.
client
.
Do
(
req
,
opt
)
req
,
err
:=
s
.
client
.
NewRequest
(
"DELETE"
,
u
,
nil
,
options
)
if
err
!=
nil
{
return
nil
,
resp
,
err
return
nil
,
err
}
return
opt
,
resp
,
err
return
s
.
client
.
Do
(
req
,
nil
)
}
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