You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2024/05/17 08:02:21 UTC

(incubator-devlake) branch kw-7421-pagerduty-remoteapi created (now f12c8e253)

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

klesh pushed a change to branch kw-7421-pagerduty-remoteapi
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


      at f12c8e253 fix: pagerduty remote api not working

This branch includes the following new commits:

     new f12c8e253 fix: pagerduty remote api not working

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(incubator-devlake) 01/01: fix: pagerduty remote api not working

Posted by kl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

klesh pushed a commit to branch kw-7421-pagerduty-remoteapi
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git

commit f12c8e2537cb7b88c86e781fb8bb3bf00424412d
Author: Klesh Wong <zh...@merico.dev>
AuthorDate: Fri May 17 16:01:38 2024 +0800

    fix: pagerduty remote api not working
---
 backend/plugins/pagerduty/api/remote_api.go | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/backend/plugins/pagerduty/api/remote_api.go b/backend/plugins/pagerduty/api/remote_api.go
index a3953432d..c03390049 100644
--- a/backend/plugins/pagerduty/api/remote_api.go
+++ b/backend/plugins/pagerduty/api/remote_api.go
@@ -46,9 +46,8 @@ type ServiceResponse struct {
 }
 
 func queryPagerdutyRemoteScopes(
-	connection *models.PagerDutyConnection,
 	apiClient plugin.ApiClient,
-	groupId string,
+	_ string,
 	page PagerdutyRemotePagination,
 	search string,
 ) (
@@ -56,11 +55,14 @@ func queryPagerdutyRemoteScopes(
 	nextPage *PagerdutyRemotePagination,
 	err errors.Error,
 ) {
+	if page.Limit == 0 {
+		page.Limit = 50
+	}
 	var res *http.Response
 	res, err = apiClient.Get("/services", url.Values{
 		"offset": {strconv.Itoa(page.Offset)},
 		"limit":  {strconv.Itoa(page.Limit)},
-		"search": {search},
+		"query":  {search},
 	}, nil)
 	if err != nil {
 		return
@@ -85,7 +87,6 @@ func queryPagerdutyRemoteScopes(
 					NoPKModel: common.NoPKModel{
 						CreatedAt: service.CreatedAt,
 					},
-					ConnectionId: connection.ID,
 				},
 			},
 		})
@@ -112,7 +113,7 @@ func listPagerdutyRemoteScopes(
 	*PagerdutyRemotePagination,
 	errors.Error,
 ) {
-	return queryPagerdutyRemoteScopes(connection, apiClient, groupId, page, "")
+	return queryPagerdutyRemoteScopes(apiClient, groupId, page, "")
 }
 
 func searchPagerdutyRemoteScopes(
@@ -122,7 +123,7 @@ func searchPagerdutyRemoteScopes(
 	children []dsmodels.DsRemoteApiScopeListEntry[models.Service],
 	err errors.Error,
 ) {
-	children, _, err = queryPagerdutyRemoteScopes(nil, apiClient, "", PagerdutyRemotePagination{
+	children, _, err = queryPagerdutyRemoteScopes(apiClient, "", PagerdutyRemotePagination{
 		Offset: (params.Page - 1) * params.PageSize,
 		Limit:  params.PageSize,
 	}, params.Search)