Skip to content

Commit

Permalink
CAPI call migration from v2 to v3
Browse files Browse the repository at this point in the history
The CAPI v2 is deprecated and will be removed in the cf-deployment.
Therefore an update is needed to use the newer CAPI v3.
  • Loading branch information
chombium authored and ctlong committed Jan 9, 2025
1 parent d75b745 commit ca95711
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion internal/command/meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,7 @@ func getSourceInfo(metaInfo map[string]*logcache_v1.MetaInfo, cli plugin.CliConn
s = append(s, id)
}

serviceInfo, err := getSourceInfoFromCAPI(s, "/v2/service_instances", cli)
serviceInfo, err := getSourceInfoFromCAPI(s, "/v3/service_instances", cli)
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions internal/command/meta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,7 @@ var _ = Describe("Meta", func() {

Expect(cliConn.cliCommandArgs[1]).To(HaveLen(2))
Expect(cliConn.cliCommandArgs[1][0]).To(Equal("curl"))
Expect(cliConn.cliCommandArgs[1][1]).To(Equal("/v2/service_instances?guids=source-2"))
Expect(cliConn.cliCommandArgs[1][1]).To(Equal("/v3/service_instances?guids=source-2"))

Expect(httpClient.requestCount()).To(Equal(1))
Expect(strings.Split(tableWriter.String(), "\n")).To(Equal([]string{
Expand Down Expand Up @@ -1002,14 +1002,14 @@ var _ = Describe("Meta", func() {
Expect(cliConn.cliCommandArgs[2][0]).To(Equal("curl"))
uri, err = url.Parse(cliConn.cliCommandArgs[2][1])
Expect(err).ToNot(HaveOccurred())
Expect(uri.Path).To(Equal("/v2/service_instances"))
Expect(uri.Path).To(Equal("/v3/service_instances"))
Expect(strings.Split(uri.Query().Get("guids"), ",")).To(HaveLen(50))

Expect(cliConn.cliCommandArgs[3]).To(HaveLen(2))
Expect(cliConn.cliCommandArgs[3][0]).To(Equal("curl"))
uri, err = url.Parse(cliConn.cliCommandArgs[3][1])
Expect(err).ToNot(HaveOccurred())
Expect(uri.Path).To(Equal("/v2/service_instances"))
Expect(uri.Path).To(Equal("/v3/service_instances"))
Expect(strings.Split(uri.Query().Get("guids"), ",")).To(HaveLen(1))

// 51 entries, 2 blank lines, "Retrieving..." preamble and table
Expand Down

0 comments on commit ca95711

Please sign in to comment.