-
Notifications
You must be signed in to change notification settings - Fork 451
Open
Description
The endpoint is always on the main jenkins url.
I would hope to see an implementation where a folder name can be passed in as "test_folder" and the endpoint would be modified to be
if folder {
endpoint := "jobs/" + folder + "/createView"
}
Or even just passing in "jobs/test_folder/jobs/test_folder2" could do nested folders 2 layers deep. Either would help.
func (j *Jenkins) CreateView(ctx context.Context, name string, viewType string) (*View, error) {
view := &View{Jenkins: j, Raw: new(ViewResponse), Base: "/view/" + name}
endpoint := "/createView"
data := map[string]string{
"name": name,
"mode": viewType,
"Submit": "OK",
"json": makeJson(map[string]string{
"name": name,
"mode": viewType,
}),
}
r, err := j.Requester.Post(ctx, endpoint, nil, view.Raw, data)
if err != nil {
return nil, err
}
if r.StatusCode == 200 {
return j.GetView(ctx, name)
}
return nil, errors.New(strconv.Itoa(r.StatusCode))
}
Metadata
Metadata
Assignees
Labels
No labels