From 368028fb548d8280a3a960b0516d3bf499b80066 Mon Sep 17 00:00:00 2001 From: Leric Zhang Date: Thu, 12 Oct 2023 10:04:55 +0800 Subject: [PATCH] feat(bamboo): add rest proxy api --- backend/plugins/bamboo/api/remote.go | 9 +++++++++ backend/plugins/bamboo/impl/impl.go | 3 +++ 2 files changed, 12 insertions(+) diff --git a/backend/plugins/bamboo/api/remote.go b/backend/plugins/bamboo/api/remote.go index e9782ae66685..ea1649e22f1e 100644 --- a/backend/plugins/bamboo/api/remote.go +++ b/backend/plugins/bamboo/api/remote.go @@ -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)) diff --git a/backend/plugins/bamboo/impl/impl.go b/backend/plugins/bamboo/impl/impl.go index 88e2311d09ef..a5e16d592a39 100644 --- a/backend/plugins/bamboo/impl/impl.go +++ b/backend/plugins/bamboo/impl/impl.go @@ -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, + }, } }