This is an automated email from the ASF dual-hosted git repository.
klesh 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 681989dbb feat(pagerduty): search remote scope by keyword (#6255)
681989dbb is described below
commit 681989dbbb53d685c96a34256cdd591717f447a8
Author: Lynwee <[email protected]>
AuthorDate: Mon Oct 16 20:45:07 2023 +0800
feat(pagerduty): search remote scope by keyword (#6255)
* feat(pagerduty): search remote scope by keyword
* feat(pagerduty): add `createdAt` field
---
backend/plugins/pagerduty/api/remote.go | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/backend/plugins/pagerduty/api/remote.go
b/backend/plugins/pagerduty/api/remote.go
index 056d09e3a..86577a085 100644
--- a/backend/plugins/pagerduty/api/remote.go
+++ b/backend/plugins/pagerduty/api/remote.go
@@ -22,6 +22,7 @@ import (
"encoding/base64"
"encoding/json"
"fmt"
+ "github.com/apache/incubator-devlake/core/models/common"
"net/http"
"net/url"
"strconv"
@@ -114,6 +115,11 @@ func RemoteScopes(input *plugin.ApiResourceInput)
(*plugin.ApiResourceOutput, er
return nil, err
}
+ search := input.Query.Get("search")
+ if search != "" {
+ query.Set("query", search)
+ }
+
var res *http.Response
outputBody := &RemoteScopesOutput{}
res, err = apiClient.Get("/services", query, nil)
@@ -136,6 +142,12 @@ func RemoteScopes(input *plugin.ApiResourceInput)
(*plugin.ApiResourceOutput, er
Url: service.HtmlUrl,
Id: service.Id,
Name: service.Name,
+ Scope: common.Scope{
+ NoPKModel: common.NoPKModel{
+ CreatedAt: service.CreatedAt,
+ },
+ ConnectionId: connection.ID,
+ },
},
}
outputBody.Children = append(outputBody.Children, child)
@@ -173,8 +185,7 @@ func RemoteScopes(input *plugin.ApiResourceInput)
(*plugin.ApiResourceOutput, er
// @Failure 500 {object} shared.ApiBody "Internal Error"
// @Router /plugins/pagerduty/connections/{connectionId}/search-remote-scopes
[GET]
func SearchRemoteScopes(input *plugin.ApiResourceInput)
(*plugin.ApiResourceOutput, errors.Error) {
- // Not supported
- return &plugin.ApiResourceOutput{Body: nil, Status:
http.StatusMethodNotAllowed}, nil
+ return RemoteScopes(input)
}
func EncodeToPageToken(pageData *PageData) (string, errors.Error) {