Skip to content

Commit

Permalink
feat(bamboo): add rest proxy api
Browse files Browse the repository at this point in the history
  • Loading branch information
leric committed Oct 23, 2023
1 parent 2871530 commit 368028f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
9 changes: 9 additions & 0 deletions backend/plugins/bamboo/api/remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,15 @@ func SearchRemoteScopes(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutp
})
}

func Proxy(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput, errors.Error) {
connection := &models.BambooConnection{}
err := connectionHelper.First(connection, input.Params)
if err != nil {
return nil, err
}
return remoteHelper.ProxyApiGet(connection, input.Params["path"], input.Query)
}

func initialQuery(queryData *api.RemoteQueryData) url.Values {
query := url.Values{}
query.Set("showEmpty", fmt.Sprintf("%v", false))
Expand Down
3 changes: 3 additions & 0 deletions backend/plugins/bamboo/impl/impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,9 @@ func (p Bamboo) ApiResources() map[string]map[string]plugin.ApiResourceHandler {
"PATCH": api.UpdateScope,
"DELETE": api.DeleteScope,
},
"connections/:connectionId/proxy/rest/*path": {
"GET": api.Proxy,
},
}
}

Expand Down

0 comments on commit 368028f

Please sign in to comment.