From dd2fdfd0f04776b5316aacff043b5eaf70fcc835 Mon Sep 17 00:00:00 2001 From: Kump3r Date: Wed, 2 Oct 2024 15:40:33 +0300 Subject: [PATCH] Switching to CloudFoundry v3 API Signed-off-by: Kump3r --- connector/cloudfoundry/cloudfoundry.go | 8 ++++---- connector/cloudfoundry/cloudfoundry_test.go | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/connector/cloudfoundry/cloudfoundry.go b/connector/cloudfoundry/cloudfoundry.go index faa86bbab1..3e3592c02f 100644 --- a/connector/cloudfoundry/cloudfoundry.go +++ b/connector/cloudfoundry/cloudfoundry.go @@ -349,10 +349,10 @@ func (c *cloudfoundryConnector) HandleCallback(s connector.Scopes, r *http.Reque identity.EmailVerified, _ = userInfoResult["email_verified"].(bool) var ( - devPath = fmt.Sprintf("/v2/users/%s/spaces", identity.UserID) - auditorPath = fmt.Sprintf("/v2/users/%s/audited_spaces", identity.UserID) - managerPath = fmt.Sprintf("/v2/users/%s/managed_spaces", identity.UserID) - orgsPath = fmt.Sprintf("/v2/users/%s/organizations", identity.UserID) + devPath = fmt.Sprintf("/v3/users/%s/spaces", identity.UserID) + auditorPath = fmt.Sprintf("/v3/users/%s/audited_spaces", identity.UserID) + managerPath = fmt.Sprintf("/v3/users/%s/managed_spaces", identity.UserID) + orgsPath = fmt.Sprintf("/v3/users/%s/organizations", identity.UserID) ) if s.Groups { diff --git a/connector/cloudfoundry/cloudfoundry_test.go b/connector/cloudfoundry/cloudfoundry_test.go index 1e6af394de..fb53b9bc52 100644 --- a/connector/cloudfoundry/cloudfoundry_test.go +++ b/connector/cloudfoundry/cloudfoundry_test.go @@ -109,7 +109,7 @@ func testSpaceHandler(reqURL, spaceAPIEndpoint string) (result map[string]interf }, } } else { - nextURL := fmt.Sprintf("/v2/users/12345/%s?order-direction=asc&page=2&results-per-page=50", spaceAPIEndpoint) + nextURL := fmt.Sprintf("/v3/users/12345/%s?order-direction=asc&page=2&results-per-page=50", spaceAPIEndpoint) result = map[string]interface{}{ "next_url": nextURL, "resources": []map[string]interface{}{ @@ -139,7 +139,7 @@ func testOrgHandler(reqURL string) (result map[string]interface{}) { } } else { result = map[string]interface{}{ - "next_url": "/v2/users/12345/organizations?order-direction=asc&page=2&results-per-page=50", + "next_url": "/v3/users/12345/organizations?order-direction=asc&page=2&results-per-page=50", "resources": []map[string]interface{}{ { "metadata": map[string]string{"guid": "some-org-guid-1"}, @@ -165,7 +165,7 @@ func testSetup() *httptest.Server { }) }) - mux.HandleFunc("/v2/info", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/v3/info", func(w http.ResponseWriter, r *http.Request) { url := fmt.Sprintf("http://%s", r.Host) json.NewEncoder(w).Encode(map[string]string{ @@ -194,7 +194,7 @@ func testSetup() *httptest.Server { }) }) - mux.HandleFunc("/v2/users/", func(w http.ResponseWriter, r *http.Request) { + mux.HandleFunc("/v3/users/", func(w http.ResponseWriter, r *http.Request) { var result map[string]interface{} reqURL := r.URL.String()