From 8e5ab1d9f13f92b341fa20df3e2c9942b19a168b Mon Sep 17 00:00:00 2001 From: srinandan Date: Thu, 12 Sep 2024 17:43:22 +0000 Subject: [PATCH] fix: adds proxy or sf name to the error #534 --- internal/client/apis/apis.go | 5 +++-- internal/client/sharedflows/sharedflows.go | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/internal/client/apis/apis.go b/internal/client/apis/apis.go index e0a5852bd..d670463e5 100644 --- a/internal/client/apis/apis.go +++ b/internal/client/apis/apis.go @@ -574,7 +574,8 @@ func importAPIProxies(wg *sync.WaitGroup, jobs <-chan string, errs chan<- error) u, _ := url.Parse(apiclient.GetApigeeBaseURL()) q := u.Query() - q.Set("name", strings.TrimSuffix(filepath.Base(job), ".zip")) + n := strings.TrimSuffix(filepath.Base(job), ".zip") + q.Set("name", n) q.Set("action", "import") u.RawQuery = q.Encode() u.Path = path.Join(u.Path, apiclient.GetApigeeOrg(), "apis") @@ -622,7 +623,7 @@ func importAPIProxies(wg *sync.WaitGroup, jobs <-chan string, errs chan<- error) b = []byte(err.Error()) } if err != nil || resp.StatusCode < 200 || resp.StatusCode >= 300 { - errs <- fmt.Errorf("bundle not imported: (HTTP %v) %s", resp.StatusCode, b) + errs <- fmt.Errorf("bundle %s not imported: (HTTP %v) %s", n, resp.StatusCode, b) continue } diff --git a/internal/client/sharedflows/sharedflows.go b/internal/client/sharedflows/sharedflows.go index 037c464ee..e2e684d84 100644 --- a/internal/client/sharedflows/sharedflows.go +++ b/internal/client/sharedflows/sharedflows.go @@ -441,7 +441,8 @@ func importSharedFlows(wg *sync.WaitGroup, jobs <-chan string, errs chan<- error u, _ := url.Parse(apiclient.GetApigeeBaseURL()) q := u.Query() - q.Set("name", strings.TrimSuffix(filepath.Base(job), ".zip")) + n := strings.TrimSuffix(filepath.Base(job), ".zip") + q.Set("name", n) q.Set("action", "import") u.RawQuery = q.Encode() u.Path = path.Join(u.Path, apiclient.GetApigeeOrg(), "sharedflows") @@ -489,7 +490,7 @@ func importSharedFlows(wg *sync.WaitGroup, jobs <-chan string, errs chan<- error b = []byte(err.Error()) } if err != nil || resp.StatusCode < 200 || resp.StatusCode >= 300 { - errs <- fmt.Errorf("bundle not imported: (HTTP %v) %s", resp.StatusCode, b) + errs <- fmt.Errorf("bundle %s not imported: (HTTP %v) %s", n, resp.StatusCode, b) continue }