This is an automated email from the ASF dual-hosted git repository.

abeizn pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new 02868dfdd feat(bamboo): add rest proxy api (#6302)
02868dfdd is described below

commit 02868dfdd6bcb25fbeb93cb94fa56c8cbe4d6e6a
Author: Leric Zhang <[email protected]>
AuthorDate: Tue Oct 24 21:43:44 2023 -0500

    feat(bamboo): add rest proxy api (#6302)
---
 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 e9782ae66..ea1649e22 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 88e2311d0..a5e16d592 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,
+               },
        }
 }
 

Reply via email to