diff --git a/.github/license/LICENSE-WITH-3RD-PARTY-LICENSES b/.github/license/LICENSE-WITH-3RD-PARTY-LICENSES index d8ce5236b07..61efe3d4d90 100644 --- a/.github/license/LICENSE-WITH-3RD-PARTY-LICENSES +++ b/.github/license/LICENSE-WITH-3RD-PARTY-LICENSES @@ -840,34 +840,35 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -For vendor/gopkg.in/cheggaaa/pb.v1: - -Copyright (c) 2012-2015, Sergey Cherepanov All rights reserved. +For vendor/github.com/cheggaaa/pb: +Copyright (c) 2012-2024, Sergey Cherepanov +All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: -* Redistributions of source code must retain the above copyright notice, this -* list of conditions and the following disclaimer. +* Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. -* Neither the name of the author nor the names of its contributors may be used -* to endorse or promote products derived from this software without specific -* prior written permission. +* Neither the name of the author nor the names of its contributors may be + used to endorse or promote products derived from this software without + specific prior written permission. -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF +THE POSSIBILITY OF SUCH DAMAGE. For vendor/github.com/sabhiram/go-gitignore: diff --git a/actor/v7action/progress_bar.go b/actor/v7action/progress_bar.go index 3b1951cabbd..efefcb7f141 100644 --- a/actor/v7action/progress_bar.go +++ b/actor/v7action/progress_bar.go @@ -5,7 +5,7 @@ import ( "os" "time" - "gopkg.in/cheggaaa/pb.v1" + "github.com/cheggaaa/pb/v3" ) //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . SimpleProgressBar @@ -34,8 +34,7 @@ func (p *ProgressBar) Initialize(path string) (io.Reader, int64, error) { return nil, 0, err } - p.bar = pb.New(int(fileInfo.Size())).SetUnits(pb.U_BYTES) - p.bar.ShowTimeLeft = false + p.bar = pb.New(int(fileInfo.Size())).Set(pb.Bytes, true) p.bar.Start() return p.bar.NewProxyReader(file), fileInfo.Size(), nil diff --git a/api/cloudcontroller/ccv3/application.go b/api/cloudcontroller/ccv3/application.go index e2530a9b736..6e1dec521cf 100644 --- a/api/cloudcontroller/ccv3/application.go +++ b/api/cloudcontroller/ccv3/application.go @@ -2,7 +2,8 @@ package ccv3 import ( "code.cloudfoundry.org/cli/api/cloudcontroller/ccerror" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -11,7 +12,7 @@ func (client *Client) CreateApplication(app resources.Application) (resources.Ap var responseBody resources.Application _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostApplicationRequest, + RequestName: ccv3internal.PostApplicationRequest, RequestBody: app, ResponseBody: &responseBody, }) @@ -42,7 +43,7 @@ func (client *Client) GetApplications(query ...Query) ([]resources.Application, var apps []resources.Application _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetApplicationsRequest, + RequestName: ccv3internal.GetApplicationsRequest, Query: query, ResponseBody: resources.Application{}, AppendToList: func(item interface{}) error { @@ -59,7 +60,7 @@ func (client *Client) UpdateApplication(app resources.Application) (resources.Ap var responseBody resources.Application _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchApplicationRequest, + RequestName: ccv3internal.PatchApplicationRequest, URIParams: internal.Params{"app_guid": app.GUID}, RequestBody: app, ResponseBody: &responseBody, @@ -72,7 +73,7 @@ func (client *Client) UpdateApplication(app resources.Application) (resources.Ap func (client *Client) UpdateApplicationName(newAppName string, appGUID string) (resources.Application, Warnings, error) { var responseBody resources.Application _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchApplicationRequest, + RequestName: ccv3internal.PatchApplicationRequest, URIParams: internal.Params{"app_guid": appGUID}, RequestBody: resources.ApplicationNameOnly{Name: newAppName}, ResponseBody: &responseBody, @@ -86,7 +87,7 @@ func (client *Client) UpdateApplicationRestart(appGUID string) (resources.Applic var responseBody resources.Application _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostApplicationActionRestartRequest, + RequestName: ccv3internal.PostApplicationActionRestartRequest, URIParams: internal.Params{"app_guid": appGUID}, ResponseBody: &responseBody, }) @@ -99,7 +100,7 @@ func (client *Client) UpdateApplicationStart(appGUID string) (resources.Applicat var responseBody resources.Application _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostApplicationActionStartRequest, + RequestName: ccv3internal.PostApplicationActionStartRequest, URIParams: internal.Params{"app_guid": appGUID}, ResponseBody: &responseBody, }) @@ -112,7 +113,7 @@ func (client *Client) UpdateApplicationStop(appGUID string) (resources.Applicati var responseBody resources.Application _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostApplicationActionStopRequest, + RequestName: ccv3internal.PostApplicationActionStopRequest, URIParams: internal.Params{"app_guid": appGUID}, ResponseBody: &responseBody, }) diff --git a/api/cloudcontroller/ccv3/application_feature.go b/api/cloudcontroller/ccv3/application_feature.go index ee07cc6cf56..bb98a098c87 100644 --- a/api/cloudcontroller/ccv3/application_feature.go +++ b/api/cloudcontroller/ccv3/application_feature.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -14,7 +15,7 @@ func (client *Client) GetAppFeature(appGUID string, featureName string) (resourc var responseBody resources.ApplicationFeature _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetApplicationFeaturesRequest, + RequestName: ccv3internal.GetApplicationFeaturesRequest, URIParams: internal.Params{"app_guid": appGUID, "name": featureName}, ResponseBody: &responseBody, }) @@ -26,7 +27,7 @@ func (client *Client) GetSSHEnabled(appGUID string) (SSHEnabled, Warnings, error var responseBody SSHEnabled _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetSSHEnabled, + RequestName: ccv3internal.GetSSHEnabled, URIParams: internal.Params{"app_guid": appGUID}, ResponseBody: &responseBody, }) @@ -37,7 +38,7 @@ func (client *Client) GetSSHEnabled(appGUID string) (SSHEnabled, Warnings, error // UpdateAppFeature enables/disables the ability to ssh for a given application. func (client *Client) UpdateAppFeature(appGUID string, enabled bool, featureName string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchApplicationFeaturesRequest, + RequestName: ccv3internal.PatchApplicationFeaturesRequest, RequestBody: struct { Enabled bool `json:"enabled"` }{Enabled: enabled}, diff --git a/api/cloudcontroller/ccv3/application_test.go b/api/cloudcontroller/ccv3/application_test.go index 46002b20b09..d8d5f1451d6 100644 --- a/api/cloudcontroller/ccv3/application_test.go +++ b/api/cloudcontroller/ccv3/application_test.go @@ -8,7 +8,8 @@ import ( . "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/ccv3fakes" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" "code.cloudfoundry.org/cli/types" . "github.com/onsi/ginkgo/v2" @@ -279,7 +280,7 @@ var _ = Describe("Application", func() { It("makes the correct request", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) actualParams := requester.MakeRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.PostApplicationRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.PostApplicationRequest)) Expect(actualParams.RequestBody).To(Equal(appToCreate)) _, ok := actualParams.ResponseBody.(*resources.Application) Expect(ok).To(BeTrue()) @@ -365,7 +366,7 @@ var _ = Describe("Application", func() { It("makes the correct request", func() { Expect(requester.MakeListRequestCallCount()).To(Equal(1)) actualParams := requester.MakeListRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.GetApplicationsRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.GetApplicationsRequest)) Expect(actualParams.Query).To(Equal([]Query{ {Key: NameFilter, Values: []string{"some-app-name"}}, {Key: SpaceGUIDFilter, Values: []string{"some-space-guid"}}, @@ -467,7 +468,7 @@ var _ = Describe("Application", func() { It("makes the correct request", func() { Expect(requester.MakeListRequestCallCount()).To(Equal(1)) actualParams := requester.MakeListRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.GetApplicationsRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.GetApplicationsRequest)) Expect(actualParams.Query).To(Equal(filters)) _, ok := actualParams.ResponseBody.(resources.Application) Expect(ok).To(BeTrue()) @@ -562,7 +563,7 @@ var _ = Describe("Application", func() { It("makes the correct request", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) actualParams := requester.MakeRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.PatchApplicationRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.PatchApplicationRequest)) Expect(actualParams.URIParams).To(Equal(internal.Params{"app_guid": "some-app-guid"})) Expect(actualParams.RequestBody).To(Equal(appToUpdate)) _, ok := actualParams.ResponseBody.(*resources.Application) @@ -660,7 +661,7 @@ var _ = Describe("Application", func() { It("makes the correct request", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) actualParams := requester.MakeRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.PatchApplicationRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.PatchApplicationRequest)) Expect(actualParams.URIParams).To(Equal(internal.Params{"app_guid": "some-app-guid"})) Expect(actualParams.RequestBody).To(Equal(resources.ApplicationNameOnly{Name: newAppName})) _, ok := actualParams.ResponseBody.(*resources.Application) @@ -749,7 +750,7 @@ var _ = Describe("Application", func() { It("makes the correct request", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) actualParams := requester.MakeRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.PostApplicationActionStopRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.PostApplicationActionStopRequest)) Expect(actualParams.URIParams).To(Equal(internal.Params{"app_guid": "some-app-guid"})) _, ok := actualParams.ResponseBody.(*resources.Application) Expect(ok).To(BeTrue()) @@ -832,7 +833,7 @@ var _ = Describe("Application", func() { It("makes the correct request", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) actualParams := requester.MakeRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.PostApplicationActionStartRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.PostApplicationActionStartRequest)) Expect(actualParams.URIParams).To(Equal(internal.Params{"app_guid": "some-app-guid"})) _, ok := actualParams.ResponseBody.(*resources.Application) Expect(ok).To(BeTrue()) @@ -915,7 +916,7 @@ var _ = Describe("Application", func() { It("makes the correct request", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) actualParams := requester.MakeRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.PostApplicationActionRestartRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.PostApplicationActionRestartRequest)) Expect(actualParams.URIParams).To(Equal(internal.Params{"app_guid": "some-app-guid"})) _, ok := actualParams.ResponseBody.(*resources.Application) Expect(ok).To(BeTrue()) diff --git a/api/cloudcontroller/ccv3/build.go b/api/cloudcontroller/ccv3/build.go index 2c671892184..6d48f7d3792 100644 --- a/api/cloudcontroller/ccv3/build.go +++ b/api/cloudcontroller/ccv3/build.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + apiinternal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -11,7 +12,7 @@ func (client *Client) CreateBuild(build resources.Build) (resources.Build, Warni var responseBody resources.Build _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostBuildRequest, + RequestName: apiinternal.PostBuildRequest, RequestBody: build, ResponseBody: &responseBody, }) @@ -24,7 +25,7 @@ func (client *Client) GetBuild(guid string) (resources.Build, Warnings, error) { var responseBody resources.Build _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetBuildRequest, + RequestName: apiinternal.GetBuildRequest, URIParams: internal.Params{"build_guid": guid}, ResponseBody: &responseBody, }) diff --git a/api/cloudcontroller/ccv3/buildpack.go b/api/cloudcontroller/ccv3/buildpack.go index 7846d58952e..7d9db05e4dc 100644 --- a/api/cloudcontroller/ccv3/buildpack.go +++ b/api/cloudcontroller/ccv3/buildpack.go @@ -3,8 +3,9 @@ package ccv3 import ( "io" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" "code.cloudfoundry.org/cli/api/cloudcontroller/uploads" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -14,7 +15,7 @@ func (client *Client) CreateBuildpack(bp resources.Buildpack) (resources.Buildpa var responseBody resources.Buildpack _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostBuildpackRequest, + RequestName: ccv3internal.PostBuildpackRequest, RequestBody: bp, ResponseBody: &responseBody, }) @@ -25,7 +26,7 @@ func (client *Client) CreateBuildpack(bp resources.Buildpack) (resources.Buildpa // DeleteBuildpack deletes the buildpack with the provided guid. func (client Client) DeleteBuildpack(buildpackGUID string) (JobURL, Warnings, error) { jobURL, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteBuildpackRequest, + RequestName: ccv3internal.DeleteBuildpackRequest, URIParams: internal.Params{"buildpack_guid": buildpackGUID}, }) @@ -37,7 +38,7 @@ func (client *Client) GetBuildpacks(query ...Query) ([]resources.Buildpack, Warn var buildpacks []resources.Buildpack _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetBuildpacksRequest, + RequestName: ccv3internal.GetBuildpacksRequest, Query: query, ResponseBody: resources.Buildpack{}, AppendToList: func(item interface{}) error { @@ -53,7 +54,7 @@ func (client Client) UpdateBuildpack(buildpack resources.Buildpack) (resources.B var responseBody resources.Buildpack _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchBuildpackRequest, + RequestName: ccv3internal.PatchBuildpackRequest, URIParams: internal.Params{"buildpack_guid": buildpack.GUID}, RequestBody: buildpack, ResponseBody: &responseBody, @@ -73,7 +74,7 @@ func (client *Client) UploadBuildpack(buildpackGUID string, buildpackPath string contentType, body, writeErrors := uploads.CreateMultipartBodyAndHeader(buildpack, buildpackPath, "bits") responseLocation, warnings, err := client.MakeRequestUploadAsync( - internal.PostBuildpackBitsRequest, + ccv3internal.PostBuildpackBitsRequest, internal.Params{"buildpack_guid": buildpackGUID}, contentType, body, diff --git a/api/cloudcontroller/ccv3/ccv3fakes/fake_clock.go b/api/cloudcontroller/ccv3/ccv3fakes/fake_clock.go index 5c41fa00cda..18981468b82 100644 --- a/api/cloudcontroller/ccv3/ccv3fakes/fake_clock.go +++ b/api/cloudcontroller/ccv3/ccv3fakes/fake_clock.go @@ -28,15 +28,16 @@ func (fake *FakeClock) Now() time.Time { ret, specificReturn := fake.nowReturnsOnCall[len(fake.nowArgsForCall)] fake.nowArgsForCall = append(fake.nowArgsForCall, struct { }{}) + stub := fake.NowStub + fakeReturns := fake.nowReturns fake.recordInvocation("Now", []interface{}{}) fake.nowMutex.Unlock() - if fake.NowStub != nil { - return fake.NowStub() + if stub != nil { + return stub() } if specificReturn { return ret.result1 } - fakeReturns := fake.nowReturns return fakeReturns.result1 } diff --git a/api/cloudcontroller/ccv3/ccv3fakes/fake_connection_wrapper.go b/api/cloudcontroller/ccv3/ccv3fakes/fake_connection_wrapper.go index 46d95f6f2f3..d37d5719151 100644 --- a/api/cloudcontroller/ccv3/ccv3fakes/fake_connection_wrapper.go +++ b/api/cloudcontroller/ccv3/ccv3fakes/fake_connection_wrapper.go @@ -43,15 +43,16 @@ func (fake *FakeConnectionWrapper) Make(arg1 *cloudcontroller.Request, arg2 *clo arg1 *cloudcontroller.Request arg2 *cloudcontroller.Response }{arg1, arg2}) + stub := fake.MakeStub + fakeReturns := fake.makeReturns fake.recordInvocation("Make", []interface{}{arg1, arg2}) fake.makeMutex.Unlock() - if fake.MakeStub != nil { - return fake.MakeStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1 } - fakeReturns := fake.makeReturns return fakeReturns.result1 } @@ -103,15 +104,16 @@ func (fake *FakeConnectionWrapper) Wrap(arg1 cloudcontroller.Connection) cloudco fake.wrapArgsForCall = append(fake.wrapArgsForCall, struct { arg1 cloudcontroller.Connection }{arg1}) + stub := fake.WrapStub + fakeReturns := fake.wrapReturns fake.recordInvocation("Wrap", []interface{}{arg1}) fake.wrapMutex.Unlock() - if fake.WrapStub != nil { - return fake.WrapStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1 } - fakeReturns := fake.wrapReturns return fakeReturns.result1 } diff --git a/api/cloudcontroller/ccv3/ccv3fakes/fake_reader.go b/api/cloudcontroller/ccv3/ccv3fakes/fake_reader.go index 09e6ccf14ce..395fb77fea9 100644 --- a/api/cloudcontroller/ccv3/ccv3fakes/fake_reader.go +++ b/api/cloudcontroller/ccv3/ccv3fakes/fake_reader.go @@ -35,15 +35,16 @@ func (fake *FakeReader) Read(arg1 []byte) (int, error) { fake.readArgsForCall = append(fake.readArgsForCall, struct { arg1 []byte }{arg1Copy}) + stub := fake.ReadStub + fakeReturns := fake.readReturns fake.recordInvocation("Read", []interface{}{arg1Copy}) fake.readMutex.Unlock() - if fake.ReadStub != nil { - return fake.ReadStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.readReturns return fakeReturns.result1, fakeReturns.result2 } diff --git a/api/cloudcontroller/ccv3/ccv3fakes/fake_requester.go b/api/cloudcontroller/ccv3/ccv3fakes/fake_requester.go index 528b7ba15b2..7bf0f8d2e0b 100644 --- a/api/cloudcontroller/ccv3/ccv3fakes/fake_requester.go +++ b/api/cloudcontroller/ccv3/ccv3fakes/fake_requester.go @@ -7,7 +7,7 @@ import ( "sync" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" ) type FakeRequester struct { @@ -140,9 +140,10 @@ func (fake *FakeRequester) InitializeConnection(arg1 ccv3.TargetSettings) { fake.initializeConnectionArgsForCall = append(fake.initializeConnectionArgsForCall, struct { arg1 ccv3.TargetSettings }{arg1}) + stub := fake.InitializeConnectionStub fake.recordInvocation("InitializeConnection", []interface{}{arg1}) fake.initializeConnectionMutex.Unlock() - if fake.InitializeConnectionStub != nil { + if stub != nil { fake.InitializeConnectionStub(arg1) } } @@ -171,9 +172,10 @@ func (fake *FakeRequester) InitializeRouter(arg1 string) { fake.initializeRouterArgsForCall = append(fake.initializeRouterArgsForCall, struct { arg1 string }{arg1}) + stub := fake.InitializeRouterStub fake.recordInvocation("InitializeRouter", []interface{}{arg1}) fake.initializeRouterMutex.Unlock() - if fake.InitializeRouterStub != nil { + if stub != nil { fake.InitializeRouterStub(arg1) } } @@ -203,15 +205,16 @@ func (fake *FakeRequester) MakeListRequest(arg1 ccv3.RequestParams) (ccv3.Includ fake.makeListRequestArgsForCall = append(fake.makeListRequestArgsForCall, struct { arg1 ccv3.RequestParams }{arg1}) + stub := fake.MakeListRequestStub + fakeReturns := fake.makeListRequestReturns fake.recordInvocation("MakeListRequest", []interface{}{arg1}) fake.makeListRequestMutex.Unlock() - if fake.MakeListRequestStub != nil { - return fake.MakeListRequestStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.makeListRequestReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -269,15 +272,16 @@ func (fake *FakeRequester) MakeRequest(arg1 ccv3.RequestParams) (ccv3.JobURL, cc fake.makeRequestArgsForCall = append(fake.makeRequestArgsForCall, struct { arg1 ccv3.RequestParams }{arg1}) + stub := fake.MakeRequestStub + fakeReturns := fake.makeRequestReturns fake.recordInvocation("MakeRequest", []interface{}{arg1}) fake.makeRequestMutex.Unlock() - if fake.MakeRequestStub != nil { - return fake.MakeRequestStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.makeRequestReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -337,15 +341,16 @@ func (fake *FakeRequester) MakeRequestReceiveRaw(arg1 string, arg2 internal.Para arg2 internal.Params arg3 string }{arg1, arg2, arg3}) + stub := fake.MakeRequestReceiveRawStub + fakeReturns := fake.makeRequestReceiveRawReturns fake.recordInvocation("MakeRequestReceiveRaw", []interface{}{arg1, arg2, arg3}) fake.makeRequestReceiveRawMutex.Unlock() - if fake.MakeRequestReceiveRawStub != nil { - return fake.MakeRequestReceiveRawStub(arg1, arg2, arg3) + if stub != nil { + return stub(arg1, arg2, arg3) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.makeRequestReceiveRawReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -412,15 +417,16 @@ func (fake *FakeRequester) MakeRequestSendRaw(arg1 string, arg2 internal.Params, arg4 string arg5 interface{} }{arg1, arg2, arg3Copy, arg4, arg5}) + stub := fake.MakeRequestSendRawStub + fakeReturns := fake.makeRequestSendRawReturns fake.recordInvocation("MakeRequestSendRaw", []interface{}{arg1, arg2, arg3Copy, arg4, arg5}) fake.makeRequestSendRawMutex.Unlock() - if fake.MakeRequestSendRawStub != nil { - return fake.MakeRequestSendRawStub(arg1, arg2, arg3, arg4, arg5) + if stub != nil { + return stub(arg1, arg2, arg3, arg4, arg5) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.makeRequestSendRawReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -486,15 +492,16 @@ func (fake *FakeRequester) MakeRequestSendReceiveRaw(arg1 string, arg2 string, a arg3 http.Header arg4 []byte }{arg1, arg2, arg3, arg4Copy}) + stub := fake.MakeRequestSendReceiveRawStub + fakeReturns := fake.makeRequestSendReceiveRawReturns fake.recordInvocation("MakeRequestSendReceiveRaw", []interface{}{arg1, arg2, arg3, arg4Copy}) fake.makeRequestSendReceiveRawMutex.Unlock() - if fake.MakeRequestSendReceiveRawStub != nil { - return fake.MakeRequestSendReceiveRawStub(arg1, arg2, arg3, arg4) + if stub != nil { + return stub(arg1, arg2, arg3, arg4) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.makeRequestSendReceiveRawReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -558,15 +565,16 @@ func (fake *FakeRequester) MakeRequestUploadAsync(arg1 string, arg2 internal.Par arg6 interface{} arg7 <-chan error }{arg1, arg2, arg3, arg4, arg5, arg6, arg7}) + stub := fake.MakeRequestUploadAsyncStub + fakeReturns := fake.makeRequestUploadAsyncReturns fake.recordInvocation("MakeRequestUploadAsync", []interface{}{arg1, arg2, arg3, arg4, arg5, arg6, arg7}) fake.makeRequestUploadAsyncMutex.Unlock() - if fake.MakeRequestUploadAsyncStub != nil { - return fake.MakeRequestUploadAsyncStub(arg1, arg2, arg3, arg4, arg5, arg6, arg7) + if stub != nil { + return stub(arg1, arg2, arg3, arg4, arg5, arg6, arg7) } if specificReturn { return ret.result1, ret.result2, ret.result3 } - fakeReturns := fake.makeRequestUploadAsyncReturns return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 } @@ -623,9 +631,10 @@ func (fake *FakeRequester) WrapConnection(arg1 ccv3.ConnectionWrapper) { fake.wrapConnectionArgsForCall = append(fake.wrapConnectionArgsForCall, struct { arg1 ccv3.ConnectionWrapper }{arg1}) + stub := fake.WrapConnectionStub fake.recordInvocation("WrapConnection", []interface{}{arg1}) fake.wrapConnectionMutex.Unlock() - if fake.WrapConnectionStub != nil { + if stub != nil { fake.WrapConnectionStub(arg1) } } diff --git a/api/cloudcontroller/ccv3/client.go b/api/cloudcontroller/ccv3/client.go index ffb7ef5d933..891b4a85042 100644 --- a/api/cloudcontroller/ccv3/client.go +++ b/api/cloudcontroller/ccv3/client.go @@ -77,7 +77,7 @@ package ccv3 import ( "time" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" ) // Warnings are a collection of warnings that the Cloud Controller can return diff --git a/api/cloudcontroller/ccv3/deployment.go b/api/cloudcontroller/ccv3/deployment.go index 3d72e47f482..1744ac25cdc 100644 --- a/api/cloudcontroller/ccv3/deployment.go +++ b/api/cloudcontroller/ccv3/deployment.go @@ -1,13 +1,14 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) func (client *Client) ContinueDeployment(deploymentGUID string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostApplicationDeploymentActionContinueRequest, + RequestName: ccv3internal.PostApplicationDeploymentActionContinueRequest, URIParams: internal.Params{"deployment_guid": deploymentGUID}, }) @@ -16,7 +17,7 @@ func (client *Client) ContinueDeployment(deploymentGUID string) (Warnings, error func (client *Client) CancelDeployment(deploymentGUID string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostApplicationDeploymentActionCancelRequest, + RequestName: ccv3internal.PostApplicationDeploymentActionCancelRequest, URIParams: internal.Params{"deployment_guid": deploymentGUID}, }) @@ -28,7 +29,7 @@ func (client *Client) CreateApplicationDeployment(dep resources.Deployment) (str var responseBody resources.Deployment _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostApplicationDeploymentRequest, + RequestName: ccv3internal.PostApplicationDeploymentRequest, RequestBody: dep, ResponseBody: &responseBody, }) @@ -40,7 +41,7 @@ func (client *Client) GetDeployment(deploymentGUID string) (resources.Deployment var responseBody resources.Deployment _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetDeploymentRequest, + RequestName: ccv3internal.GetDeploymentRequest, URIParams: internal.Params{"deployment_guid": deploymentGUID}, ResponseBody: &responseBody, }) @@ -52,7 +53,7 @@ func (client *Client) GetDeployments(query ...Query) ([]resources.Deployment, Wa var deployments []resources.Deployment _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetDeploymentsRequest, + RequestName: ccv3internal.GetDeploymentsRequest, Query: query, ResponseBody: resources.Deployment{}, AppendToList: func(item interface{}) error { diff --git a/api/cloudcontroller/ccv3/domain.go b/api/cloudcontroller/ccv3/domain.go index 6b0aae2141c..d0624ecd13c 100644 --- a/api/cloudcontroller/ccv3/domain.go +++ b/api/cloudcontroller/ccv3/domain.go @@ -5,7 +5,8 @@ import ( "fmt" "code.cloudfoundry.org/cli/api/cloudcontroller" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -79,7 +80,7 @@ func (client Client) CheckRoute(domainGUID string, hostname string, path string, } _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetDomainRouteReservationsRequest, + RequestName: ccv3internal.GetDomainRouteReservationsRequest, URIParams: internal.Params{"domain_guid": domainGUID}, Query: query, ResponseBody: &responseBody, @@ -92,7 +93,7 @@ func (client Client) CreateDomain(domain resources.Domain) (resources.Domain, Wa var responseBody resources.Domain _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostDomainRequest, + RequestName: ccv3internal.PostDomainRequest, RequestBody: domain, ResponseBody: &responseBody, }) @@ -102,7 +103,7 @@ func (client Client) CreateDomain(domain resources.Domain) (resources.Domain, Wa func (client Client) DeleteDomain(domainGUID string) (JobURL, Warnings, error) { jobURL, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteDomainRequest, + RequestName: ccv3internal.DeleteDomainRequest, URIParams: internal.Params{"domain_guid": domainGUID}, }) @@ -114,7 +115,7 @@ func (client *Client) GetDomain(domainGUID string) (resources.Domain, Warnings, var responseBody resources.Domain _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetDomainRequest, + RequestName: ccv3internal.GetDomainRequest, URIParams: internal.Params{"domain_guid": domainGUID}, ResponseBody: &responseBody, }) @@ -126,7 +127,7 @@ func (client Client) GetDomains(query ...Query) ([]resources.Domain, Warnings, e var domains []resources.Domain _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetDomainsRequest, + RequestName: ccv3internal.GetDomainsRequest, Query: query, ResponseBody: resources.Domain{}, AppendToList: func(item interface{}) error { @@ -143,7 +144,7 @@ func (client Client) GetOrganizationDomains(orgGUID string, query ...Query) ([]r _, warnings, err := client.MakeListRequest(RequestParams{ URIParams: internal.Params{"organization_guid": orgGUID}, - RequestName: internal.GetOrganizationDomainsRequest, + RequestName: ccv3internal.GetOrganizationDomainsRequest, Query: query, ResponseBody: resources.Domain{}, AppendToList: func(item interface{}) error { @@ -157,7 +158,7 @@ func (client Client) GetOrganizationDomains(orgGUID string, query ...Query) ([]r func (client Client) SharePrivateDomainToOrgs(domainGuid string, sharedOrgs SharedOrgs) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.SharePrivateDomainRequest, + RequestName: ccv3internal.SharePrivateDomainRequest, URIParams: internal.Params{"domain_guid": domainGuid}, RequestBody: sharedOrgs, }) @@ -167,7 +168,7 @@ func (client Client) SharePrivateDomainToOrgs(domainGuid string, sharedOrgs Shar func (client Client) UnsharePrivateDomainFromOrg(domainGuid string, orgGUID string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteSharedOrgFromDomainRequest, + RequestName: ccv3internal.DeleteSharedOrgFromDomainRequest, URIParams: internal.Params{"domain_guid": domainGuid, "org_guid": orgGUID}, }) diff --git a/api/cloudcontroller/ccv3/droplet.go b/api/cloudcontroller/ccv3/droplet.go index 7d9bfe5e703..0dc13d9669a 100644 --- a/api/cloudcontroller/ccv3/droplet.go +++ b/api/cloudcontroller/ccv3/droplet.go @@ -4,8 +4,9 @@ import ( "io" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" "code.cloudfoundry.org/cli/api/cloudcontroller/uploads" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -25,7 +26,7 @@ func (client *Client) CreateDroplet(appGUID string) (resources.Droplet, Warnings var responseBody resources.Droplet _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostDropletRequest, + RequestName: ccv3internal.PostDropletRequest, RequestBody: requestBody, ResponseBody: &responseBody, }) @@ -39,7 +40,7 @@ func (client *Client) GetApplicationDropletCurrent(appGUID string) (resources.Dr var responseBody resources.Droplet _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetApplicationDropletCurrentRequest, + RequestName: ccv3internal.GetApplicationDropletCurrentRequest, URIParams: internal.Params{"app_guid": appGUID}, ResponseBody: &responseBody, }) @@ -52,7 +53,7 @@ func (client *Client) GetDroplet(dropletGUID string) (resources.Droplet, Warning var responseBody resources.Droplet _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetDropletRequest, + RequestName: ccv3internal.GetDropletRequest, URIParams: internal.Params{"droplet_guid": dropletGUID}, ResponseBody: &responseBody, }) @@ -65,7 +66,7 @@ func (client *Client) GetDroplets(query ...Query) ([]resources.Droplet, Warnings var droplets []resources.Droplet _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetDropletsRequest, + RequestName: ccv3internal.GetDropletsRequest, Query: query, ResponseBody: resources.Droplet{}, AppendToList: func(item interface{}) error { @@ -82,7 +83,7 @@ func (client *Client) GetPackageDroplets(packageGUID string, query ...Query) ([] var droplets []resources.Droplet _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetPackageDropletsRequest, + RequestName: ccv3internal.GetPackageDropletsRequest, URIParams: internal.Params{"package_guid": packageGUID}, Query: query, ResponseBody: resources.Droplet{}, @@ -106,7 +107,7 @@ func (client *Client) UploadDropletBits(dropletGUID string, dropletPath string, contentType, body, writeErrors := uploads.CreateMultipartBodyAndHeader(droplet, dropletPath, "bits") responseLocation, warnings, err := client.MakeRequestUploadAsync( - internal.PostDropletBitsRequest, + ccv3internal.PostDropletBitsRequest, internal.Params{"droplet_guid": dropletGUID}, contentType, body, @@ -120,7 +121,7 @@ func (client *Client) UploadDropletBits(dropletGUID string, dropletPath string, func (client *Client) DownloadDroplet(dropletGUID string) ([]byte, Warnings, error) { bytes, warnings, err := client.MakeRequestReceiveRaw( - internal.GetDropletBitsRequest, + ccv3internal.GetDropletBitsRequest, internal.Params{"droplet_guid": dropletGUID}, "application/json", ) diff --git a/api/cloudcontroller/ccv3/droplet_test.go b/api/cloudcontroller/ccv3/droplet_test.go index 2e8f9eed293..f26b8a06d4b 100644 --- a/api/cloudcontroller/ccv3/droplet_test.go +++ b/api/cloudcontroller/ccv3/droplet_test.go @@ -13,8 +13,9 @@ import ( . "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/ccv3fakes" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" "code.cloudfoundry.org/cli/api/cloudcontroller/wrapper" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -53,7 +54,7 @@ var _ = Describe("Droplet", func() { It("makes the correct request", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) actualParams := requester.MakeRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.PostDropletRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.PostDropletRequest)) Expect(actualParams.RequestBody).To(Equal(DropletCreateRequest{ Relationships: resources.Relationships{ constant.RelationshipTypeApplication: resources.Relationship{GUID: "app-guid"}, @@ -91,7 +92,7 @@ var _ = Describe("Droplet", func() { It("makes the correct request", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) actualParams := requester.MakeRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.GetApplicationDropletCurrentRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.GetApplicationDropletCurrentRequest)) Expect(actualParams.URIParams).To(Equal(internal.Params{"app_guid": "some-app-guid"})) _, ok := actualParams.ResponseBody.(*resources.Droplet) Expect(ok).To(BeTrue()) @@ -129,7 +130,7 @@ var _ = Describe("Droplet", func() { It("makes the correct request", func() { Expect(requester.MakeListRequestCallCount()).To(Equal(1)) actualParams := requester.MakeListRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.GetPackageDropletsRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.GetPackageDropletsRequest)) Expect(actualParams.URIParams).To(Equal(internal.Params{"package_guid": "package-guid"})) _, ok := actualParams.ResponseBody.(resources.Droplet) Expect(ok).To(BeTrue()) @@ -163,7 +164,7 @@ var _ = Describe("Droplet", func() { It("makes the correct request", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) actualParams := requester.MakeRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.GetDropletRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.GetDropletRequest)) Expect(actualParams.URIParams).To(Equal(internal.Params{"droplet_guid": "some-guid"})) _, ok := actualParams.ResponseBody.(*resources.Droplet) Expect(ok).To(BeTrue()) @@ -201,7 +202,7 @@ var _ = Describe("Droplet", func() { It("makes the correct request", func() { Expect(requester.MakeListRequestCallCount()).To(Equal(1)) actualParams := requester.MakeListRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.GetDropletsRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.GetDropletsRequest)) Expect(actualParams.Query).To(Equal([]Query{ {Key: AppGUIDFilter, Values: []string{"some-app-guid"}}, {Key: PerPage, Values: []string{"2"}}, @@ -441,7 +442,7 @@ var _ = Describe("Droplet", func() { It("makes the correct request", func() { Expect(requester.MakeRequestReceiveRawCallCount()).To(Equal(1)) requestType, requestParams, responseType := requester.MakeRequestReceiveRawArgsForCall(0) - Expect(requestType).To(Equal(internal.GetDropletBitsRequest)) + Expect(requestType).To(Equal(ccv3internal.GetDropletBitsRequest)) Expect(requestParams).To(Equal(internal.Params{"droplet_guid": "some-droplet-guid"})) Expect(responseType).To(Equal("application/json")) }) diff --git a/api/cloudcontroller/ccv3/environment.go b/api/cloudcontroller/ccv3/environment.go index 45af18d5bbe..d3e94963d5e 100644 --- a/api/cloudcontroller/ccv3/environment.go +++ b/api/cloudcontroller/ccv3/environment.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" ) // Environment variables that will be provided to an app at runtime. It will @@ -30,7 +31,7 @@ func (client *Client) GetApplicationEnvironment(appGUID string) (Environment, Wa var responseBody Environment _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetApplicationEnvRequest, + RequestName: ccv3internal.GetApplicationEnvRequest, URIParams: internal.Params{"app_guid": appGUID}, ResponseBody: &responseBody, }) diff --git a/api/cloudcontroller/ccv3/environment_variables.go b/api/cloudcontroller/ccv3/environment_variables.go index 22c50d8f97c..ed5636a07d3 100644 --- a/api/cloudcontroller/ccv3/environment_variables.go +++ b/api/cloudcontroller/ccv3/environment_variables.go @@ -2,7 +2,8 @@ package ccv3 import ( "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -14,7 +15,7 @@ func (client *Client) GetEnvironmentVariableGroup(group constant.EnvironmentVari var responseBody resources.EnvironmentVariables _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetEnvironmentVariableGroupRequest, + RequestName: ccv3internal.GetEnvironmentVariableGroupRequest, URIParams: internal.Params{"group_name": string(group)}, ResponseBody: &responseBody, }) @@ -29,7 +30,7 @@ func (client *Client) UpdateApplicationEnvironmentVariables(appGUID string, envV var responseBody resources.EnvironmentVariables _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchApplicationEnvironmentVariablesRequest, + RequestName: ccv3internal.PatchApplicationEnvironmentVariablesRequest, URIParams: internal.Params{"app_guid": appGUID}, RequestBody: envVars, ResponseBody: &responseBody, @@ -42,7 +43,7 @@ func (client *Client) UpdateEnvironmentVariableGroup(group constant.EnvironmentV var responseBody resources.EnvironmentVariables _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchEnvironmentVariableGroupRequest, + RequestName: ccv3internal.PatchEnvironmentVariableGroupRequest, URIParams: internal.Params{"group_name": string(group)}, RequestBody: envVars, ResponseBody: &responseBody, diff --git a/api/cloudcontroller/ccv3/feature_flag.go b/api/cloudcontroller/ccv3/feature_flag.go index 80f775acc8e..cface3f9a15 100644 --- a/api/cloudcontroller/ccv3/feature_flag.go +++ b/api/cloudcontroller/ccv3/feature_flag.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -9,7 +10,7 @@ func (client *Client) GetFeatureFlag(flagName string) (resources.FeatureFlag, Wa var responseBody resources.FeatureFlag _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetFeatureFlagRequest, + RequestName: ccv3internal.GetFeatureFlagRequest, URIParams: internal.Params{"name": flagName}, ResponseBody: &responseBody, }) @@ -22,7 +23,7 @@ func (client *Client) GetFeatureFlags() ([]resources.FeatureFlag, Warnings, erro var featureFlags []resources.FeatureFlag _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetFeatureFlagsRequest, + RequestName: ccv3internal.GetFeatureFlagsRequest, ResponseBody: resources.FeatureFlag{}, AppendToList: func(item interface{}) error { featureFlags = append(featureFlags, item.(resources.FeatureFlag)) @@ -37,7 +38,7 @@ func (client *Client) UpdateFeatureFlag(flag resources.FeatureFlag) (resources.F var responseBody resources.FeatureFlag _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchFeatureFlagRequest, + RequestName: ccv3internal.PatchFeatureFlagRequest, URIParams: internal.Params{"name": flag.Name}, RequestBody: flag, ResponseBody: &responseBody, diff --git a/api/cloudcontroller/ccv3/internal/api_routes.go b/api/cloudcontroller/ccv3/internal/api_routes.go index 05d5607eb33..1ed29e730f1 100644 --- a/api/cloudcontroller/ccv3/internal/api_routes.go +++ b/api/cloudcontroller/ccv3/internal/api_routes.go @@ -1,6 +1,10 @@ package internal -import "net/http" +import ( + "net/http" + + "code.cloudfoundry.org/cli/api/internal" +) // Naming convention: // @@ -182,7 +186,7 @@ const ( ) // APIRoutes is a list of routes used by the router to construct request URLs. -var APIRoutes = map[string]Route{ +var APIRoutes = map[string]internal.Route{ GetApplicationsRequest: {Path: "/v3/apps", Method: http.MethodGet}, PostApplicationRequest: {Path: "/v3/apps", Method: http.MethodPost}, DeleteApplicationRequest: {Path: "/v3/apps/:app_guid", Method: http.MethodDelete}, diff --git a/api/cloudcontroller/ccv3/isolation_segment.go b/api/cloudcontroller/ccv3/isolation_segment.go index 16dbd4ec174..703003e0084 100644 --- a/api/cloudcontroller/ccv3/isolation_segment.go +++ b/api/cloudcontroller/ccv3/isolation_segment.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -12,7 +13,7 @@ func (client *Client) CreateIsolationSegment(isolationSegment resources.Isolatio var responseBody resources.IsolationSegment _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostIsolationSegmentsRequest, + RequestName: ccv3internal.PostIsolationSegmentsRequest, RequestBody: isolationSegment, ResponseBody: &responseBody, }) @@ -25,7 +26,7 @@ func (client *Client) CreateIsolationSegment(isolationSegment resources.Isolatio // database. It will not remove it from diego. func (client *Client) DeleteIsolationSegment(guid string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteIsolationSegmentRequest, + RequestName: ccv3internal.DeleteIsolationSegmentRequest, URIParams: internal.Params{"isolation_segment_guid": guid}, }) @@ -38,7 +39,7 @@ func (client *Client) GetIsolationSegment(guid string) (resources.IsolationSegme var responseBody resources.IsolationSegment _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetIsolationSegmentRequest, + RequestName: ccv3internal.GetIsolationSegmentRequest, URIParams: internal.Params{"isolation_segment_guid": guid}, ResponseBody: &responseBody, }) @@ -51,7 +52,7 @@ func (client *Client) GetIsolationSegments(query ...Query) ([]resources.Isolatio var isolationSegments []resources.IsolationSegment _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetIsolationSegmentsRequest, + RequestName: ccv3internal.GetIsolationSegmentsRequest, Query: query, ResponseBody: resources.IsolationSegment{}, AppendToList: func(item interface{}) error { diff --git a/api/cloudcontroller/ccv3/job_url.go b/api/cloudcontroller/ccv3/job_url.go index f49a965789f..b8b7f744e29 100644 --- a/api/cloudcontroller/ccv3/job_url.go +++ b/api/cloudcontroller/ccv3/job_url.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" ) // JobURL is the URL to a given Job. @@ -11,7 +12,7 @@ type JobURL string // resulting job URL to poll. func (client *Client) DeleteApplication(appGUID string) (JobURL, Warnings, error) { jobURL, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteApplicationRequest, + RequestName: ccv3internal.DeleteApplicationRequest, URIParams: internal.Params{"app_guid": appGUID}, }) @@ -22,7 +23,7 @@ func (client *Client) DeleteApplication(appGUID string) (JobURL, Warnings, error // application. Returns back a resulting job URL to poll. func (client *Client) UpdateApplicationApplyManifest(appGUID string, rawManifest []byte) (JobURL, Warnings, error) { responseLocation, warnings, err := client.MakeRequestSendRaw( - internal.PostApplicationActionApplyManifest, + ccv3internal.PostApplicationActionApplyManifest, internal.Params{"app_guid": appGUID}, rawManifest, "application/x-yaml", @@ -44,7 +45,7 @@ func (client *Client) UpdateApplicationApplyManifest(appGUID string, rawManifest func (client *Client) UpdateSpaceApplyManifest(spaceGUID string, rawManifest []byte) (JobURL, Warnings, error) { responseLocation, warnings, err := client.MakeRequestSendRaw( - internal.PostSpaceActionApplyManifestRequest, + ccv3internal.PostSpaceActionApplyManifestRequest, internal.Params{"space_guid": spaceGUID}, rawManifest, "application/x-yaml", diff --git a/api/cloudcontroller/ccv3/manifest.go b/api/cloudcontroller/ccv3/manifest.go index fba84e1c40a..f7daff5adb1 100644 --- a/api/cloudcontroller/ccv3/manifest.go +++ b/api/cloudcontroller/ccv3/manifest.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -9,7 +10,7 @@ import ( // underlying processes. func (client *Client) GetApplicationManifest(appGUID string) ([]byte, Warnings, error) { bytes, warnings, err := client.MakeRequestReceiveRaw( - internal.GetApplicationManifestRequest, + ccv3internal.GetApplicationManifestRequest, internal.Params{"app_guid": appGUID}, "application/x-yaml", ) @@ -21,7 +22,7 @@ func (client *Client) GetSpaceManifestDiff(spaceGUID string, rawManifest []byte) var responseBody resources.ManifestDiff _, warnings, err := client.MakeRequestSendRaw( - internal.PostSpaceDiffManifestRequest, + ccv3internal.PostSpaceDiffManifestRequest, internal.Params{"space_guid": spaceGUID}, rawManifest, "application/x-yaml", diff --git a/api/cloudcontroller/ccv3/manifest_test.go b/api/cloudcontroller/ccv3/manifest_test.go index 4038a805562..a559d9433d3 100644 --- a/api/cloudcontroller/ccv3/manifest_test.go +++ b/api/cloudcontroller/ccv3/manifest_test.go @@ -8,7 +8,8 @@ import ( "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3" . "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/ccv3fakes" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/cf/util/testhelpers/matchers" "code.cloudfoundry.org/cli/resources" . "github.com/onsi/ginkgo/v2" @@ -54,7 +55,7 @@ var _ = Describe("Application Manifest", func() { It("makes the correct request", func() { Expect(requester.MakeRequestReceiveRawCallCount()).To(Equal(1)) requestName, uriParams, responseBody := requester.MakeRequestReceiveRawArgsForCall(0) - Expect(requestName).To(Equal(internal.GetApplicationManifestRequest)) + Expect(requestName).To(Equal(ccv3internal.GetApplicationManifestRequest)) Expect(uriParams).To(Equal(internal.Params{"app_guid": appGUID})) Expect(responseBody).To(Equal("application/x-yaml")) }) diff --git a/api/cloudcontroller/ccv3/metadata.go b/api/cloudcontroller/ccv3/metadata.go index a909e49f182..b3a14a454a6 100644 --- a/api/cloudcontroller/ccv3/metadata.go +++ b/api/cloudcontroller/ccv3/metadata.go @@ -3,7 +3,8 @@ package ccv3 import ( "fmt" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -14,67 +15,67 @@ func (client *Client) UpdateResourceMetadata(resource string, resourceGUID strin switch resource { case "app": params = RequestParams{ - RequestName: internal.PatchApplicationRequest, + RequestName: ccv3internal.PatchApplicationRequest, RequestBody: requestMetadata, URIParams: internal.Params{"app_guid": resourceGUID}, } case "buildpack": params = RequestParams{ - RequestName: internal.PatchBuildpackRequest, + RequestName: ccv3internal.PatchBuildpackRequest, RequestBody: requestMetadata, URIParams: internal.Params{"buildpack_guid": resourceGUID}, } case "domain": params = RequestParams{ - RequestName: internal.PatchDomainRequest, + RequestName: ccv3internal.PatchDomainRequest, RequestBody: requestMetadata, URIParams: internal.Params{"domain_guid": resourceGUID}, } case "org": params = RequestParams{ - RequestName: internal.PatchOrganizationRequest, + RequestName: ccv3internal.PatchOrganizationRequest, RequestBody: requestMetadata, URIParams: internal.Params{"organization_guid": resourceGUID}, } case "route": params = RequestParams{ - RequestName: internal.PatchRouteRequest, + RequestName: ccv3internal.PatchRouteRequest, RequestBody: requestMetadata, URIParams: internal.Params{"route_guid": resourceGUID}, } case "service-broker": params = RequestParams{ - RequestName: internal.PatchServiceBrokerRequest, + RequestName: ccv3internal.PatchServiceBrokerRequest, URIParams: internal.Params{"service_broker_guid": resourceGUID}, RequestBody: resources.ResourceMetadata{Metadata: &metadata}, } case "service-instance": params = RequestParams{ - RequestName: internal.PatchServiceInstanceRequest, + RequestName: ccv3internal.PatchServiceInstanceRequest, URIParams: internal.Params{"service_instance_guid": resourceGUID}, RequestBody: resources.ResourceMetadata{Metadata: &metadata}, } case "service-offering": params = RequestParams{ - RequestName: internal.PatchServiceOfferingRequest, + RequestName: ccv3internal.PatchServiceOfferingRequest, RequestBody: requestMetadata, URIParams: internal.Params{"service_offering_guid": resourceGUID}, } case "service-plan": params = RequestParams{ - RequestName: internal.PatchServicePlanRequest, + RequestName: ccv3internal.PatchServicePlanRequest, RequestBody: requestMetadata, URIParams: internal.Params{"service_plan_guid": resourceGUID}, } case "space": params = RequestParams{ - RequestName: internal.PatchSpaceRequest, + RequestName: ccv3internal.PatchSpaceRequest, RequestBody: requestMetadata, URIParams: internal.Params{"space_guid": resourceGUID}, } case "stack": params = RequestParams{ - RequestName: internal.PatchStackRequest, + RequestName: ccv3internal.PatchStackRequest, RequestBody: requestMetadata, URIParams: internal.Params{"stack_guid": resourceGUID}, } diff --git a/api/cloudcontroller/ccv3/organization.go b/api/cloudcontroller/ccv3/organization.go index b75cad50e9a..116e4ffdb0e 100644 --- a/api/cloudcontroller/ccv3/organization.go +++ b/api/cloudcontroller/ccv3/organization.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -10,7 +11,7 @@ func (client *Client) CreateOrganization(orgName string) (resources.Organization var responseBody resources.Organization _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostOrganizationRequest, + RequestName: ccv3internal.PostOrganizationRequest, RequestBody: org, ResponseBody: &responseBody, }) @@ -21,7 +22,7 @@ func (client *Client) CreateOrganization(orgName string) (resources.Organization // DeleteOrganization deletes the organization with the given GUID. func (client *Client) DeleteOrganization(orgGUID string) (JobURL, Warnings, error) { jobURL, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteOrganizationRequest, + RequestName: ccv3internal.DeleteOrganizationRequest, URIParams: internal.Params{"organization_guid": orgGUID}, }) @@ -33,7 +34,7 @@ func (client *Client) GetDefaultDomain(orgGUID string) (resources.Domain, Warnin var responseBody resources.Domain _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetDefaultDomainRequest, + RequestName: ccv3internal.GetDefaultDomainRequest, URIParams: internal.Params{"organization_guid": orgGUID}, ResponseBody: &responseBody, }) @@ -47,7 +48,7 @@ func (client *Client) GetIsolationSegmentOrganizations(isolationSegmentGUID stri var organizations []resources.Organization _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetIsolationSegmentOrganizationsRequest, + RequestName: ccv3internal.GetIsolationSegmentOrganizationsRequest, URIParams: internal.Params{"isolation_segment_guid": isolationSegmentGUID}, ResponseBody: resources.Organization{}, AppendToList: func(item interface{}) error { @@ -64,7 +65,7 @@ func (client *Client) GetOrganization(orgGUID string) (resources.Organization, W var responseBody resources.Organization _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetOrganizationRequest, + RequestName: ccv3internal.GetOrganizationRequest, URIParams: internal.Params{"organization_guid": orgGUID}, ResponseBody: &responseBody, }) @@ -77,7 +78,7 @@ func (client *Client) GetOrganizations(query ...Query) ([]resources.Organization var organizations []resources.Organization _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetOrganizationsRequest, + RequestName: ccv3internal.GetOrganizationsRequest, Query: query, ResponseBody: resources.Organization{}, AppendToList: func(item interface{}) error { @@ -97,7 +98,7 @@ func (client *Client) UpdateOrganization(org resources.Organization) (resources. var responseBody resources.Organization _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchOrganizationRequest, + RequestName: ccv3internal.PatchOrganizationRequest, URIParams: internal.Params{"organization_guid": orgGUID}, RequestBody: org, ResponseBody: &responseBody, diff --git a/api/cloudcontroller/ccv3/organization_quota.go b/api/cloudcontroller/ccv3/organization_quota.go index 8812493a565..97f3e5260b9 100644 --- a/api/cloudcontroller/ccv3/organization_quota.go +++ b/api/cloudcontroller/ccv3/organization_quota.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -9,7 +10,7 @@ func (client *Client) ApplyOrganizationQuota(quotaGuid, orgGuid string) (resourc var responseBody resources.RelationshipList _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostOrganizationQuotaApplyRequest, + RequestName: ccv3internal.PostOrganizationQuotaApplyRequest, URIParams: internal.Params{"quota_guid": quotaGuid}, RequestBody: resources.RelationshipList{GUIDs: []string{orgGuid}}, ResponseBody: &responseBody, @@ -22,7 +23,7 @@ func (client *Client) CreateOrganizationQuota(orgQuota resources.OrganizationQuo var responseOrgQuota resources.OrganizationQuota _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostOrganizationQuotaRequest, + RequestName: ccv3internal.PostOrganizationQuotaRequest, RequestBody: orgQuota, ResponseBody: &responseOrgQuota, }) @@ -32,7 +33,7 @@ func (client *Client) CreateOrganizationQuota(orgQuota resources.OrganizationQuo func (client *Client) DeleteOrganizationQuota(quotaGUID string) (JobURL, Warnings, error) { jobURL, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteOrganizationQuotaRequest, + RequestName: ccv3internal.DeleteOrganizationQuotaRequest, URIParams: internal.Params{"quota_guid": quotaGUID}, }) @@ -43,7 +44,7 @@ func (client *Client) GetOrganizationQuota(quotaGUID string) (resources.Organiza var responseBody resources.OrganizationQuota _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetOrganizationQuotaRequest, + RequestName: ccv3internal.GetOrganizationQuotaRequest, URIParams: internal.Params{"quota_guid": quotaGUID}, ResponseBody: &responseBody, }) @@ -55,7 +56,7 @@ func (client *Client) GetOrganizationQuotas(query ...Query) ([]resources.Organiz var organizationQuotas []resources.OrganizationQuota _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetOrganizationQuotasRequest, + RequestName: ccv3internal.GetOrganizationQuotasRequest, Query: query, ResponseBody: resources.OrganizationQuota{}, AppendToList: func(item interface{}) error { @@ -74,7 +75,7 @@ func (client *Client) UpdateOrganizationQuota(orgQuota resources.OrganizationQuo var responseBody resources.OrganizationQuota _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchOrganizationQuotaRequest, + RequestName: ccv3internal.PatchOrganizationQuotaRequest, URIParams: internal.Params{"quota_guid": orgQuotaGUID}, RequestBody: orgQuota, ResponseBody: &responseBody, diff --git a/api/cloudcontroller/ccv3/package.go b/api/cloudcontroller/ccv3/package.go index 0dcdfcaaaf2..facc75d44ca 100644 --- a/api/cloudcontroller/ccv3/package.go +++ b/api/cloudcontroller/ccv3/package.go @@ -11,7 +11,8 @@ import ( "code.cloudfoundry.org/cli/api/cloudcontroller" "code.cloudfoundry.org/cli/api/cloudcontroller/ccerror" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -23,7 +24,7 @@ func (client *Client) CreatePackage(pkg resources.Package) (resources.Package, W var responseBody resources.Package _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostPackageRequest, + RequestName: ccv3internal.PostPackageRequest, RequestBody: pkg, ResponseBody: &responseBody, }) @@ -36,7 +37,7 @@ func (client *Client) GetPackage(packageGUID string) (resources.Package, Warning var responseBody resources.Package _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetPackageRequest, + RequestName: ccv3internal.GetPackageRequest, URIParams: internal.Params{"package_guid": packageGUID}, ResponseBody: &responseBody, }) @@ -49,7 +50,7 @@ func (client *Client) GetPackages(query ...Query) ([]resources.Package, Warnings var packages []resources.Package _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetPackagesRequest, + RequestName: ccv3internal.GetPackagesRequest, Query: query, ResponseBody: resources.Package{}, AppendToList: func(item interface{}) error { @@ -92,7 +93,7 @@ func (client *Client) UploadPackage(pkg resources.Package, fileToUpload string) responsePackage := resources.Package{} _, warnings, err := client.MakeRequestSendRaw( - internal.PostPackageBitsRequest, + ccv3internal.PostPackageBitsRequest, internal.Params{"package_guid": pkg.GUID}, body.Bytes(), contentType, @@ -108,7 +109,7 @@ func (client *Client) CopyPackage(sourcePkgGUID string, targetAppGUID string) (r var targetPackage resources.Package _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostPackageRequest, + RequestName: ccv3internal.PostPackageRequest, Query: []Query{{Key: SourceGUID, Values: []string{sourcePkgGUID}}}, RequestBody: map[string]resources.Relationships{ "relationships": { @@ -234,7 +235,7 @@ func (client *Client) uploadExistingResourcesOnly(packageGUID string, matchedRes responsePackage := resources.Package{} _, warnings, err := client.MakeRequestSendRaw( - internal.PostPackageBitsRequest, + ccv3internal.PostPackageBitsRequest, internal.Params{"package_guid": packageGUID}, body.Bytes(), form.FormDataContentType(), @@ -254,7 +255,7 @@ func (client *Client) uploadNewAndExistingResources(packageGUID string, matchedR responseBody := resources.Package{} _, warnings, err := client.MakeRequestUploadAsync( - internal.PostPackageBitsRequest, + ccv3internal.PostPackageBitsRequest, internal.Params{"package_guid": packageGUID}, contentType, body, diff --git a/api/cloudcontroller/ccv3/process.go b/api/cloudcontroller/ccv3/process.go index d03f2885fb9..ff7f7593837 100644 --- a/api/cloudcontroller/ccv3/process.go +++ b/api/cloudcontroller/ccv3/process.go @@ -2,7 +2,8 @@ package ccv3 import ( "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -11,7 +12,7 @@ func (client *Client) CreateApplicationProcessScale(appGUID string, process reso var responseBody resources.Process _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostApplicationProcessActionScaleRequest, + RequestName: ccv3internal.PostApplicationProcessActionScaleRequest, URIParams: internal.Params{"app_guid": appGUID, "type": process.Type}, RequestBody: process, ResponseBody: &responseBody, @@ -25,7 +26,7 @@ func (client *Client) GetApplicationProcessByType(appGUID string, processType st var responseBody resources.Process _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetApplicationProcessRequest, + RequestName: ccv3internal.GetApplicationProcessRequest, URIParams: internal.Params{"app_guid": appGUID, "type": processType}, ResponseBody: &responseBody, }) @@ -39,7 +40,7 @@ func (client *Client) GetApplicationProcesses(appGUID string) ([]resources.Proce var processes []resources.Process _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetApplicationProcessesRequest, + RequestName: ccv3internal.GetApplicationProcessesRequest, URIParams: internal.Params{"app_guid": appGUID}, ResponseBody: resources.Process{}, AppendToList: func(item interface{}) error { @@ -95,7 +96,7 @@ func (client *Client) GetProcess(processGUID string) (resources.Process, Warning var responseBody resources.Process _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetProcessRequest, + RequestName: ccv3internal.GetProcessRequest, URIParams: internal.Params{"process_guid": processGUID}, ResponseBody: &responseBody, }) @@ -107,7 +108,7 @@ func (client Client) GetProcesses(query ...Query) ([]resources.Process, Warnings var processes []resources.Process _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetProcessesRequest, + RequestName: ccv3internal.GetProcessesRequest, Query: query, ResponseBody: resources.Process{}, AppendToList: func(item interface{}) error { @@ -126,7 +127,7 @@ func (client *Client) UpdateProcess(process resources.Process) (resources.Proces var responseBody resources.Process _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchProcessRequest, + RequestName: ccv3internal.PatchProcessRequest, URIParams: internal.Params{"process_guid": process.GUID}, RequestBody: resources.Process{ Command: process.Command, diff --git a/api/cloudcontroller/ccv3/process_instance.go b/api/cloudcontroller/ccv3/process_instance.go index da5764a6f15..6adbdb14d92 100644 --- a/api/cloudcontroller/ccv3/process_instance.go +++ b/api/cloudcontroller/ccv3/process_instance.go @@ -7,7 +7,8 @@ import ( "code.cloudfoundry.org/cli/api/cloudcontroller" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/types" ) @@ -93,7 +94,7 @@ func (instance *ProcessInstance) UnmarshalJSON(data []byte) error { // process instance. func (client *Client) DeleteApplicationProcessInstance(appGUID string, processType string, instanceIndex int) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteApplicationProcessInstanceRequest, + RequestName: ccv3internal.DeleteApplicationProcessInstanceRequest, URIParams: internal.Params{ "app_guid": appGUID, "type": processType, @@ -109,7 +110,7 @@ func (client *Client) GetProcessInstances(processGUID string) ([]ProcessInstance var resources []ProcessInstance _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetProcessStatsRequest, + RequestName: ccv3internal.GetProcessStatsRequest, URIParams: internal.Params{"process_guid": processGUID}, ResponseBody: ProcessInstance{}, AppendToList: func(item interface{}) error { diff --git a/api/cloudcontroller/ccv3/relationship.go b/api/cloudcontroller/ccv3/relationship.go index e4ed3b81eff..bf9e0834e0e 100644 --- a/api/cloudcontroller/ccv3/relationship.go +++ b/api/cloudcontroller/ccv3/relationship.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -9,7 +10,7 @@ import ( // the isolation segment and the organization provided. func (client *Client) DeleteIsolationSegmentOrganization(isolationSegmentGUID string, orgGUID string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteIsolationSegmentRelationshipOrganizationRequest, + RequestName: ccv3internal.DeleteIsolationSegmentRelationshipOrganizationRequest, URIParams: internal.Params{"isolation_segment_guid": isolationSegmentGUID, "organization_guid": orgGUID}, }) @@ -22,7 +23,7 @@ func (client *Client) GetOrganizationDefaultIsolationSegment(orgGUID string) (re var responseBody resources.Relationship _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetOrganizationRelationshipDefaultIsolationSegmentRequest, + RequestName: ccv3internal.GetOrganizationRelationshipDefaultIsolationSegmentRequest, URIParams: internal.Params{"organization_guid": orgGUID}, ResponseBody: &responseBody, }) @@ -36,7 +37,7 @@ func (client *Client) GetSpaceIsolationSegment(spaceGUID string) (resources.Rela var responseBody resources.Relationship _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetSpaceRelationshipIsolationSegmentRequest, + RequestName: ccv3internal.GetSpaceRelationshipIsolationSegmentRequest, URIParams: internal.Params{"space_guid": spaceGUID}, ResponseBody: &responseBody, }) @@ -49,7 +50,7 @@ func (client *Client) SetApplicationDroplet(appGUID string, dropletGUID string) var responseBody resources.Relationship _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchApplicationCurrentDropletRequest, + RequestName: ccv3internal.PatchApplicationCurrentDropletRequest, URIParams: internal.Params{"app_guid": appGUID}, RequestBody: resources.Relationship{GUID: dropletGUID}, ResponseBody: &responseBody, @@ -65,7 +66,7 @@ func (client *Client) UpdateOrganizationDefaultIsolationSegmentRelationship(orgG var responseBody resources.Relationship _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchOrganizationRelationshipDefaultIsolationSegmentRequest, + RequestName: ccv3internal.PatchOrganizationRelationshipDefaultIsolationSegmentRequest, URIParams: internal.Params{"organization_guid": orgGUID}, RequestBody: resources.Relationship{GUID: isoSegGUID}, ResponseBody: &responseBody, @@ -80,7 +81,7 @@ func (client *Client) UpdateSpaceIsolationSegmentRelationship(spaceGUID string, var responseBody resources.Relationship _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchSpaceRelationshipIsolationSegmentRequest, + RequestName: ccv3internal.PatchSpaceRelationshipIsolationSegmentRequest, URIParams: internal.Params{"space_guid": spaceGUID}, RequestBody: resources.Relationship{GUID: isolationSegmentGUID}, ResponseBody: &responseBody, diff --git a/api/cloudcontroller/ccv3/relationship_list.go b/api/cloudcontroller/ccv3/relationship_list.go index a60adef2505..bbb7a6eda19 100644 --- a/api/cloudcontroller/ccv3/relationship_list.go +++ b/api/cloudcontroller/ccv3/relationship_list.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -11,7 +12,7 @@ func (client *Client) EntitleIsolationSegmentToOrganizations(isolationSegmentGUI var responseBody resources.RelationshipList _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostIsolationSegmentRelationshipOrganizationsRequest, + RequestName: ccv3internal.PostIsolationSegmentRelationshipOrganizationsRequest, URIParams: internal.Params{"isolation_segment_guid": isolationSegmentGUID}, RequestBody: resources.RelationshipList{GUIDs: organizationGUIDs}, ResponseBody: &responseBody, diff --git a/api/cloudcontroller/ccv3/request.go b/api/cloudcontroller/ccv3/request.go index 65b988ac784..42d67fc02aa 100644 --- a/api/cloudcontroller/ccv3/request.go +++ b/api/cloudcontroller/ccv3/request.go @@ -6,7 +6,8 @@ import ( "strings" "code.cloudfoundry.org/cli/api/cloudcontroller" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" ) // requestOptions contains all the options to create an HTTP request. @@ -81,5 +82,5 @@ func (requester *RealRequester) newHTTPRequest(passedRequest requestOptions) (*c } func isDownloadDroplet(URL string, requestName string) bool { - return (strings.Contains(URL, "droplet") && strings.Contains(URL, "download")) || (requestName == internal.GetDropletBitsRequest) + return (strings.Contains(URL, "droplet") && strings.Contains(URL, "download")) || (requestName == ccv3internal.GetDropletBitsRequest) } diff --git a/api/cloudcontroller/ccv3/requester.go b/api/cloudcontroller/ccv3/requester.go index f0982fc6293..d2c02c05399 100644 --- a/api/cloudcontroller/ccv3/requester.go +++ b/api/cloudcontroller/ccv3/requester.go @@ -9,7 +9,8 @@ import ( "runtime" "code.cloudfoundry.org/cli/api/cloudcontroller" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" ) //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . Requester @@ -86,7 +87,7 @@ func (requester *RealRequester) InitializeConnection(settings TargetSettings) { } func (requester *RealRequester) InitializeRouter(baseURL string) { - requester.router = internal.NewRouter(internal.APIRoutes, baseURL) + requester.router = internal.NewRouter(ccv3internal.APIRoutes, baseURL) } func (requester *RealRequester) MakeListRequest(requestParams RequestParams) (IncludedResources, Warnings, error) { diff --git a/api/cloudcontroller/ccv3/requester_test.go b/api/cloudcontroller/ccv3/requester_test.go index 6b078ece01b..c3158c32dce 100644 --- a/api/cloudcontroller/ccv3/requester_test.go +++ b/api/cloudcontroller/ccv3/requester_test.go @@ -11,7 +11,8 @@ import ( "code.cloudfoundry.org/cli/api/cloudcontroller/ccerror" . "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" . "code.cloudfoundry.org/cli/resources" "code.cloudfoundry.org/cli/types" @@ -51,7 +52,7 @@ var _ = Describe("shared request helpers", func() { BeforeEach(func() { requestParams = RequestParams{ - RequestName: internal.GetOrganizationRequest, + RequestName: ccv3internal.GetOrganizationRequest, URIParams: internal.Params{"organization_guid": "some-org-guid"}, ResponseBody: &responseBody, } @@ -148,7 +149,7 @@ var _ = Describe("shared request helpers", func() { } requestParams = RequestParams{ - RequestName: internal.PostBuildpackRequest, + RequestName: ccv3internal.PostBuildpackRequest, RequestBody: requestBody, ResponseBody: &responseBody, } @@ -269,7 +270,7 @@ var _ = Describe("shared request helpers", func() { Context("DELETE resource", func() { BeforeEach(func() { requestParams = RequestParams{ - RequestName: internal.DeleteSpaceRequest, + RequestName: ccv3internal.DeleteSpaceRequest, URIParams: internal.Params{"space_guid": "space-guid"}, } }) @@ -333,7 +334,7 @@ var _ = Describe("shared request helpers", func() { SpaceGUID: "some-space-guid", } requestParams = RequestParams{ - RequestName: internal.PatchApplicationRequest, + RequestName: ccv3internal.PatchApplicationRequest, URIParams: internal.Params{"app_guid": requestBody.GUID}, RequestBody: requestBody, ResponseBody: &responseBody, @@ -565,7 +566,7 @@ var _ = Describe("shared request helpers", func() { }, } requestParams = RequestParams{ - RequestName: internal.GetRolesRequest, + RequestName: ccv3internal.GetRolesRequest, Query: query, ResponseBody: resources.Role{}, AppendToList: func(item interface{}) error { @@ -873,7 +874,7 @@ var _ = Describe("shared request helpers", func() { ) requestParams = RequestParams{ - RequestName: internal.GetApplicationProcessesRequest, + RequestName: ccv3internal.GetApplicationProcessesRequest, URIParams: internal.Params{"app_guid": appGUID}, ResponseBody: Process{}, AppendToList: func(item interface{}) error { @@ -954,7 +955,7 @@ var _ = Describe("shared request helpers", func() { }, } requestParams = RequestParams{ - RequestName: internal.GetStacksRequest, + RequestName: ccv3internal.GetStacksRequest, Query: query, ResponseBody: resources.Stack{}, AppendToList: func(item interface{}) error { @@ -1055,7 +1056,7 @@ var _ = Describe("shared request helpers", func() { ) BeforeEach(func() { - requestName = internal.GetApplicationManifestRequest + requestName = ccv3internal.GetApplicationManifestRequest responseBodyMimeType = "application/x-yaml" uriParams = internal.Params{"app_guid": "some-app-guid"} }) @@ -1140,7 +1141,7 @@ var _ = Describe("shared request helpers", func() { Context("Download a droplet", func() { BeforeEach(func() { - requestName = internal.GetDropletBitsRequest + requestName = ccv3internal.GetDropletBitsRequest uriParams = internal.Params{"droplet_guid": "some-droplet-guid"} }) @@ -1187,7 +1188,7 @@ var _ = Describe("shared request helpers", func() { expectedJobURL = "apply-manifest-job-url" responseBody = Package{} - requestName = internal.PostPackageBitsRequest + requestName = ccv3internal.PostPackageBitsRequest uriParams = internal.Params{"package_guid": "package-guid"} requestBodyMimeType = "multipart/form-data" }) @@ -1323,7 +1324,7 @@ var _ = Describe("shared request helpers", func() { }) JustBeforeEach(func() { responseBody = Package{} - requestName = internal.PostPackageBitsRequest + requestName = ccv3internal.PostPackageBitsRequest requestBodyMimeType = "multipart/form-data" uriParams = internal.Params{"package_guid": "package-guid"} diff --git a/api/cloudcontroller/ccv3/revisions.go b/api/cloudcontroller/ccv3/revisions.go index d50fca2630b..d5bcb59d8c3 100644 --- a/api/cloudcontroller/ccv3/revisions.go +++ b/api/cloudcontroller/ccv3/revisions.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -9,7 +10,7 @@ func (client *Client) GetApplicationRevisions(appGUID string, query ...Query) ([ var revisions []resources.Revision _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetApplicationRevisionsRequest, + RequestName: ccv3internal.GetApplicationRevisionsRequest, Query: query, URIParams: internal.Params{"app_guid": appGUID}, ResponseBody: resources.Revision{}, @@ -25,7 +26,7 @@ func (client *Client) GetApplicationRevisionsDeployed(appGUID string) ([]resourc var revisions []resources.Revision _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetApplicationRevisionsDeployedRequest, + RequestName: ccv3internal.GetApplicationRevisionsDeployedRequest, URIParams: internal.Params{"app_guid": appGUID}, ResponseBody: resources.Revision{}, AppendToList: func(item interface{}) error { diff --git a/api/cloudcontroller/ccv3/role.go b/api/cloudcontroller/ccv3/role.go index 7e12f96dc8b..e24d60f1711 100644 --- a/api/cloudcontroller/ccv3/role.go +++ b/api/cloudcontroller/ccv3/role.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -9,7 +10,7 @@ func (client *Client) CreateRole(roleSpec resources.Role) (resources.Role, Warni var responseBody resources.Role _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostRoleRequest, + RequestName: ccv3internal.PostRoleRequest, RequestBody: roleSpec, ResponseBody: &responseBody, }) @@ -19,7 +20,7 @@ func (client *Client) CreateRole(roleSpec resources.Role) (resources.Role, Warni func (client *Client) DeleteRole(roleGUID string) (JobURL, Warnings, error) { jobURL, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteRoleRequest, + RequestName: ccv3internal.DeleteRoleRequest, URIParams: internal.Params{"role_guid": roleGUID}, }) @@ -31,7 +32,7 @@ func (client *Client) GetRoles(query ...Query) ([]resources.Role, IncludedResour var roles []resources.Role includedResources, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetRolesRequest, + RequestName: ccv3internal.GetRolesRequest, Query: query, ResponseBody: resources.Role{}, AppendToList: func(item interface{}) error { diff --git a/api/cloudcontroller/ccv3/route.go b/api/cloudcontroller/ccv3/route.go index afff0af5e9a..f8ef3480f90 100644 --- a/api/cloudcontroller/ccv3/route.go +++ b/api/cloudcontroller/ccv3/route.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -9,7 +10,7 @@ func (client Client) CreateRoute(route resources.Route) (resources.Route, Warnin var responseBody resources.Route _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostRouteRequest, + RequestName: ccv3internal.PostRouteRequest, RequestBody: route, ResponseBody: &responseBody, }) @@ -19,7 +20,7 @@ func (client Client) CreateRoute(route resources.Route) (resources.Route, Warnin func (client Client) DeleteOrphanedRoutes(spaceGUID string) (JobURL, Warnings, error) { jobURL, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteOrphanedRoutesRequest, + RequestName: ccv3internal.DeleteOrphanedRoutesRequest, URIParams: internal.Params{"space_guid": spaceGUID}, Query: []Query{{Key: UnmappedFilter, Values: []string{"true"}}}, }) @@ -29,7 +30,7 @@ func (client Client) DeleteOrphanedRoutes(spaceGUID string) (JobURL, Warnings, e func (client Client) DeleteRoute(routeGUID string) (JobURL, Warnings, error) { jobURL, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteRouteRequest, + RequestName: ccv3internal.DeleteRouteRequest, URIParams: internal.Params{"route_guid": routeGUID}, }) @@ -40,7 +41,7 @@ func (client Client) GetApplicationRoutes(appGUID string) ([]resources.Route, Wa var routes []resources.Route _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetApplicationRoutesRequest, + RequestName: ccv3internal.GetApplicationRoutesRequest, URIParams: internal.Params{"app_guid": appGUID}, ResponseBody: resources.Route{}, AppendToList: func(item interface{}) error { @@ -58,7 +59,7 @@ func (client Client) GetRouteDestinations(routeGUID string) ([]resources.RouteDe } _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetRouteDestinationsRequest, + RequestName: ccv3internal.GetRouteDestinationsRequest, URIParams: internal.Params{"route_guid": routeGUID}, ResponseBody: &responseBody, }) @@ -70,7 +71,7 @@ func (client Client) GetRoutes(query ...Query) ([]resources.Route, Warnings, err var routes []resources.Route _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetRoutesRequest, + RequestName: ccv3internal.GetRoutesRequest, Query: query, ResponseBody: resources.Route{}, AppendToList: func(item interface{}) error { @@ -112,7 +113,7 @@ func (client Client) MapRoute(routeGUID string, appGUID string, destinationProto } _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.MapRouteRequest, + RequestName: ccv3internal.MapRouteRequest, URIParams: internal.Params{"route_guid": routeGUID}, RequestBody: &requestBody, }) @@ -124,7 +125,7 @@ func (client Client) UnmapRoute(routeGUID string, destinationGUID string) (Warni var responseBody resources.Build _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.UnmapRouteRequest, + RequestName: ccv3internal.UnmapRouteRequest, URIParams: internal.Params{"route_guid": routeGUID, "destination_guid": destinationGUID}, ResponseBody: &responseBody, }) @@ -136,7 +137,7 @@ func (client Client) UnshareRoute(routeGUID string, spaceGUID string) (Warnings, var responseBody resources.Build _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.UnshareRouteRequest, + RequestName: ccv3internal.UnshareRouteRequest, URIParams: internal.Params{"route_guid": routeGUID, "space_guid": spaceGUID}, ResponseBody: &responseBody, }) @@ -152,7 +153,7 @@ func (client Client) UpdateDestination(routeGUID string, destinationGUID string, } var responseBody resources.Build _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchDestinationRequest, + RequestName: ccv3internal.PatchDestinationRequest, URIParams: internal.Params{"route_guid": routeGUID, "destination_guid": destinationGUID}, RequestBody: &requestBody, ResponseBody: &responseBody, @@ -177,7 +178,7 @@ func (client Client) ShareRoute(routeGUID string, spaceGUID string) (Warnings, e var responseBody resources.Build _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.ShareRouteRequest, + RequestName: ccv3internal.ShareRouteRequest, URIParams: internal.Params{"route_guid": routeGUID}, RequestBody: &requestBody, ResponseBody: &responseBody, @@ -202,7 +203,7 @@ func (client Client) MoveRoute(routeGUID string, spaceGUID string) (Warnings, er var responseBody resources.Build _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchMoveRouteRequest, + RequestName: ccv3internal.PatchMoveRouteRequest, URIParams: internal.Params{"route_guid": routeGUID}, RequestBody: &requestBody, ResponseBody: &responseBody, diff --git a/api/cloudcontroller/ccv3/route_binding.go b/api/cloudcontroller/ccv3/route_binding.go index 643479d628d..78e8593fb71 100644 --- a/api/cloudcontroller/ccv3/route_binding.go +++ b/api/cloudcontroller/ccv3/route_binding.go @@ -1,13 +1,14 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) func (client *Client) CreateRouteBinding(binding resources.RouteBinding) (JobURL, Warnings, error) { return client.MakeRequest(RequestParams{ - RequestName: internal.PostRouteBindingRequest, + RequestName: ccv3internal.PostRouteBindingRequest, RequestBody: binding, }) } @@ -16,7 +17,7 @@ func (client *Client) GetRouteBindings(query ...Query) ([]resources.RouteBinding var result []resources.RouteBinding included, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetRouteBindingsRequest, + RequestName: ccv3internal.GetRouteBindingsRequest, Query: query, ResponseBody: resources.RouteBinding{}, AppendToList: func(item interface{}) error { @@ -30,7 +31,7 @@ func (client *Client) GetRouteBindings(query ...Query) ([]resources.RouteBinding func (client *Client) DeleteRouteBinding(guid string) (JobURL, Warnings, error) { return client.MakeRequest(RequestParams{ - RequestName: internal.DeleteRouteBindingRequest, + RequestName: ccv3internal.DeleteRouteBindingRequest, URIParams: internal.Params{"route_binding_guid": guid}, }) } diff --git a/api/cloudcontroller/ccv3/route_binding_test.go b/api/cloudcontroller/ccv3/route_binding_test.go index 6321d4faad2..f26d1bed58b 100644 --- a/api/cloudcontroller/ccv3/route_binding_test.go +++ b/api/cloudcontroller/ccv3/route_binding_test.go @@ -8,7 +8,8 @@ import ( "code.cloudfoundry.org/cli/api/cloudcontroller/ccerror" . "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/ccv3fakes" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -43,7 +44,7 @@ var _ = Describe("RouteBinding", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) Expect(requester.MakeRequestArgsForCall(0)).To(Equal(RequestParams{ - RequestName: internal.PostRouteBindingRequest, + RequestName: ccv3internal.PostRouteBindingRequest, RequestBody: binding, })) }) @@ -94,7 +95,7 @@ var _ = Describe("RouteBinding", func() { It("makes the correct call", func() { Expect(requester.MakeListRequestCallCount()).To(Equal(1)) actualParams := requester.MakeListRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.GetRouteBindingsRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.GetRouteBindingsRequest)) Expect(actualParams.Query).To(ConsistOf(Query{Key: ServiceInstanceGUIDFilter, Values: []string{"si-1-guid", "si-2-guid", "si-3-guid", "si-4-guid"}})) Expect(actualParams.ResponseBody).To(BeAssignableToTypeOf(resources.RouteBinding{})) }) @@ -198,7 +199,7 @@ var _ = Describe("RouteBinding", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) Expect(requester.MakeRequestArgsForCall(0)).To(Equal(RequestParams{ - RequestName: internal.DeleteRouteBindingRequest, + RequestName: ccv3internal.DeleteRouteBindingRequest, URIParams: internal.Params{"route_binding_guid": guid}, })) }) diff --git a/api/cloudcontroller/ccv3/security_group.go b/api/cloudcontroller/ccv3/security_group.go index 1880769ceff..f08c617e651 100644 --- a/api/cloudcontroller/ccv3/security_group.go +++ b/api/cloudcontroller/ccv3/security_group.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -9,7 +10,7 @@ func (client *Client) CreateSecurityGroup(securityGroup resources.SecurityGroup) var responseBody resources.SecurityGroup _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostSecurityGroupRequest, + RequestName: ccv3internal.PostSecurityGroupRequest, RequestBody: securityGroup, ResponseBody: &responseBody, }) @@ -21,7 +22,7 @@ func (client *Client) GetSecurityGroups(queries ...Query) ([]resources.SecurityG var securityGroups []resources.SecurityGroup _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetSecurityGroupsRequest, + RequestName: ccv3internal.GetSecurityGroupsRequest, Query: queries, ResponseBody: resources.SecurityGroup{}, AppendToList: func(item interface{}) error { @@ -37,7 +38,7 @@ func (client *Client) GetRunningSecurityGroups(spaceGUID string, queries ...Quer var securityGroups []resources.SecurityGroup _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetSpaceRunningSecurityGroupsRequest, + RequestName: ccv3internal.GetSpaceRunningSecurityGroupsRequest, URIParams: internal.Params{"space_guid": spaceGUID}, Query: queries, ResponseBody: resources.SecurityGroup{}, @@ -54,7 +55,7 @@ func (client *Client) GetStagingSecurityGroups(spaceGUID string, queries ...Quer var securityGroups []resources.SecurityGroup _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetSpaceStagingSecurityGroupsRequest, + RequestName: ccv3internal.GetSpaceStagingSecurityGroupsRequest, URIParams: internal.Params{"space_guid": spaceGUID}, Query: queries, ResponseBody: resources.SecurityGroup{}, @@ -69,7 +70,7 @@ func (client *Client) GetStagingSecurityGroups(spaceGUID string, queries ...Quer func (client *Client) UnbindSecurityGroupRunningSpace(securityGroupGUID string, spaceGUID string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteSecurityGroupRunningSpaceRequest, + RequestName: ccv3internal.DeleteSecurityGroupRunningSpaceRequest, URIParams: internal.Params{ "security_group_guid": securityGroupGUID, "space_guid": spaceGUID, @@ -81,7 +82,7 @@ func (client *Client) UnbindSecurityGroupRunningSpace(securityGroupGUID string, func (client *Client) UnbindSecurityGroupStagingSpace(securityGroupGUID string, spaceGUID string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteSecurityGroupStagingSpaceRequest, + RequestName: ccv3internal.DeleteSecurityGroupStagingSpaceRequest, URIParams: internal.Params{ "security_group_guid": securityGroupGUID, "space_guid": spaceGUID, @@ -93,7 +94,7 @@ func (client *Client) UnbindSecurityGroupStagingSpace(securityGroupGUID string, func (client *Client) UpdateSecurityGroupRunningSpace(securityGroupGUID string, spaceGUIDs []string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostSecurityGroupRunningSpaceRequest, + RequestName: ccv3internal.PostSecurityGroupRunningSpaceRequest, URIParams: internal.Params{"security_group_guid": securityGroupGUID}, RequestBody: resources.RelationshipList{ GUIDs: spaceGUIDs, @@ -105,7 +106,7 @@ func (client *Client) UpdateSecurityGroupRunningSpace(securityGroupGUID string, func (client *Client) UpdateSecurityGroupStagingSpace(securityGroupGUID string, spaceGUIDs []string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostSecurityGroupStagingSpaceRequest, + RequestName: ccv3internal.PostSecurityGroupStagingSpaceRequest, URIParams: internal.Params{"security_group_guid": securityGroupGUID}, RequestBody: resources.RelationshipList{ GUIDs: spaceGUIDs, @@ -123,7 +124,7 @@ func (client *Client) UpdateSecurityGroup(securityGroup resources.SecurityGroup) securityGroup.Name = "" _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchSecurityGroupRequest, + RequestName: ccv3internal.PatchSecurityGroupRequest, URIParams: internal.Params{"security_group_guid": securityGroupGUID}, RequestBody: securityGroup, ResponseBody: &responseBody, @@ -134,7 +135,7 @@ func (client *Client) UpdateSecurityGroup(securityGroup resources.SecurityGroup) func (client *Client) DeleteSecurityGroup(securityGroupGUID string) (JobURL, Warnings, error) { jobURL, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteSecurityGroupRequest, + RequestName: ccv3internal.DeleteSecurityGroupRequest, URIParams: internal.Params{"security_group_guid": securityGroupGUID}, }) diff --git a/api/cloudcontroller/ccv3/security_group_test.go b/api/cloudcontroller/ccv3/security_group_test.go index b2a1e915aea..2b64d725ac9 100644 --- a/api/cloudcontroller/ccv3/security_group_test.go +++ b/api/cloudcontroller/ccv3/security_group_test.go @@ -5,7 +5,8 @@ import ( . "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/ccv3fakes" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" . "code.cloudfoundry.org/cli/cf/util/testhelpers/matchers" "code.cloudfoundry.org/cli/resources" @@ -57,7 +58,7 @@ var _ = Describe("SecurityGroup", func() { It("makes the correct request", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) actualParams := requester.MakeRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.PostSecurityGroupRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.PostSecurityGroupRequest)) Expect(actualParams.RequestBody).To(Equal(securityGroupParams)) Expect(actualParams.ResponseBody).To(HaveTypeOf(&resources.SecurityGroup{})) }) @@ -93,7 +94,7 @@ var _ = Describe("SecurityGroup", func() { Expect(requester.MakeListRequestCallCount()).To(Equal(1)) params := requester.MakeListRequestArgsForCall(0) - Expect(params.RequestName).To(Equal(internal.GetSecurityGroupsRequest)) + Expect(params.RequestName).To(Equal(ccv3internal.GetSecurityGroupsRequest)) Expect(params.Query).To(Equal([]Query{query})) Expect(params.ResponseBody).To(Equal(resources.SecurityGroup{})) }) @@ -133,7 +134,7 @@ var _ = Describe("SecurityGroup", func() { Expect(requester.MakeListRequestCallCount()).To(Equal(1)) params := requester.MakeListRequestArgsForCall(0) - Expect(params.RequestName).To(Equal(internal.GetSpaceRunningSecurityGroupsRequest)) + Expect(params.RequestName).To(Equal(ccv3internal.GetSpaceRunningSecurityGroupsRequest)) Expect(params.URIParams).To(Equal(internal.Params{"space_guid": spaceGUID})) Expect(params.Query).To(Equal([]Query{query})) Expect(params.ResponseBody).To(Equal(resources.SecurityGroup{})) @@ -174,7 +175,7 @@ var _ = Describe("SecurityGroup", func() { Expect(requester.MakeListRequestCallCount()).To(Equal(1)) params := requester.MakeListRequestArgsForCall(0) - Expect(params.RequestName).To(Equal(internal.GetSpaceStagingSecurityGroupsRequest)) + Expect(params.RequestName).To(Equal(ccv3internal.GetSpaceStagingSecurityGroupsRequest)) Expect(params.URIParams).To(Equal(internal.Params{"space_guid": spaceGUID})) Expect(params.Query).To(Equal([]Query{query})) Expect(params.ResponseBody).To(Equal(resources.SecurityGroup{})) @@ -210,7 +211,7 @@ var _ = Describe("SecurityGroup", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) params := requester.MakeRequestArgsForCall(0) - Expect(params.RequestName).To(Equal(internal.DeleteSecurityGroupRunningSpaceRequest)) + Expect(params.RequestName).To(Equal(ccv3internal.DeleteSecurityGroupRunningSpaceRequest)) Expect(params.URIParams).To(Equal(internal.Params{ "security_group_guid": securityGroupGUID, "space_guid": spaceGUID, })) @@ -242,7 +243,7 @@ var _ = Describe("SecurityGroup", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) params := requester.MakeRequestArgsForCall(0) - Expect(params.RequestName).To(Equal(internal.DeleteSecurityGroupStagingSpaceRequest)) + Expect(params.RequestName).To(Equal(ccv3internal.DeleteSecurityGroupStagingSpaceRequest)) Expect(params.URIParams).To(Equal(internal.Params{ "security_group_guid": securityGroupGUID, "space_guid": spaceGUID, })) @@ -274,7 +275,7 @@ var _ = Describe("SecurityGroup", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) params := requester.MakeRequestArgsForCall(0) - Expect(params.RequestName).To(Equal(internal.PostSecurityGroupRunningSpaceRequest)) + Expect(params.RequestName).To(Equal(ccv3internal.PostSecurityGroupRunningSpaceRequest)) Expect(params.URIParams).To(Equal(internal.Params{"security_group_guid": securityGroupGUID})) Expect(params.RequestBody).To(Equal(resources.RelationshipList{ GUIDs: spaceGUIDs, @@ -307,7 +308,7 @@ var _ = Describe("SecurityGroup", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) params := requester.MakeRequestArgsForCall(0) - Expect(params.RequestName).To(Equal(internal.PostSecurityGroupStagingSpaceRequest)) + Expect(params.RequestName).To(Equal(ccv3internal.PostSecurityGroupStagingSpaceRequest)) Expect(params.URIParams).To(Equal(internal.Params{"security_group_guid": securityGroupGUID})) Expect(params.RequestBody).To(Equal(resources.RelationshipList{ GUIDs: spaceGUIDs, @@ -350,7 +351,7 @@ var _ = Describe("SecurityGroup", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) params := requester.MakeRequestArgsForCall(0) - Expect(params.RequestName).To(Equal(internal.PatchSecurityGroupRequest)) + Expect(params.RequestName).To(Equal(ccv3internal.PatchSecurityGroupRequest)) Expect(params.URIParams).To(Equal(internal.Params{"security_group_guid": securityGroup.GUID})) Expect(params.RequestBody).To(Equal(resources.SecurityGroup{ StagingGloballyEnabled: &trueValue, @@ -386,7 +387,7 @@ var _ = Describe("SecurityGroup", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) params := requester.MakeRequestArgsForCall(0) - Expect(params.RequestName).To(Equal(internal.DeleteSecurityGroupRequest)) + Expect(params.RequestName).To(Equal(ccv3internal.DeleteSecurityGroupRequest)) Expect(params.URIParams).To(Equal(internal.Params{"security_group_guid": securityGroupGUID})) }) diff --git a/api/cloudcontroller/ccv3/service_broker.go b/api/cloudcontroller/ccv3/service_broker.go index c61b0d9fa23..247809414ae 100644 --- a/api/cloudcontroller/ccv3/service_broker.go +++ b/api/cloudcontroller/ccv3/service_broker.go @@ -3,7 +3,8 @@ package ccv3 import ( "errors" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -12,7 +13,7 @@ func (client *Client) CreateServiceBroker(serviceBroker resources.ServiceBroker) serviceBroker.CredentialsType = resources.ServiceBrokerBasicCredentials jobURL, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostServiceBrokerRequest, + RequestName: ccv3internal.PostServiceBrokerRequest, RequestBody: serviceBroker, }) @@ -22,7 +23,7 @@ func (client *Client) CreateServiceBroker(serviceBroker resources.ServiceBroker) // DeleteServiceBroker deletes a named service broker func (client *Client) DeleteServiceBroker(serviceBrokerGUID string) (JobURL, Warnings, error) { jobURL, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteServiceBrokerRequest, + RequestName: ccv3internal.DeleteServiceBrokerRequest, URIParams: internal.Params{"service_broker_guid": serviceBrokerGUID}, }) @@ -34,7 +35,7 @@ func (client *Client) GetServiceBrokers(query ...Query) ([]resources.ServiceBrok var result []resources.ServiceBroker _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetServiceBrokersRequest, + RequestName: ccv3internal.GetServiceBrokersRequest, Query: query, ResponseBody: resources.ServiceBroker{}, AppendToList: func(item interface{}) error { @@ -57,7 +58,7 @@ func (client *Client) UpdateServiceBroker(serviceBrokerGUID string, serviceBroke } jobURL, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchServiceBrokerRequest, + RequestName: ccv3internal.PatchServiceBrokerRequest, URIParams: internal.Params{"service_broker_guid": serviceBrokerGUID}, RequestBody: serviceBroker, }) diff --git a/api/cloudcontroller/ccv3/service_credential_binding.go b/api/cloudcontroller/ccv3/service_credential_binding.go index 8d3910273c8..b3c37bd4f0b 100644 --- a/api/cloudcontroller/ccv3/service_credential_binding.go +++ b/api/cloudcontroller/ccv3/service_credential_binding.go @@ -1,14 +1,15 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" "code.cloudfoundry.org/cli/util/lookuptable" ) func (client *Client) CreateServiceCredentialBinding(binding resources.ServiceCredentialBinding) (JobURL, Warnings, error) { return client.MakeRequest(RequestParams{ - RequestName: internal.PostServiceCredentialBindingRequest, + RequestName: ccv3internal.PostServiceCredentialBindingRequest, RequestBody: binding, }) } @@ -21,7 +22,7 @@ func (client *Client) GetServiceCredentialBindings(query ...Query) ([]resources. var result []resources.ServiceCredentialBinding included, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetServiceCredentialBindingsRequest, + RequestName: ccv3internal.GetServiceCredentialBindingsRequest, Query: query, ResponseBody: resources.ServiceCredentialBinding{}, AppendToList: func(item interface{}) error { @@ -44,14 +45,14 @@ func (client *Client) GetServiceCredentialBindings(query ...Query) ([]resources. func (client *Client) DeleteServiceCredentialBinding(guid string) (JobURL, Warnings, error) { return client.MakeRequest(RequestParams{ - RequestName: internal.DeleteServiceCredentialBindingRequest, + RequestName: ccv3internal.DeleteServiceCredentialBindingRequest, URIParams: internal.Params{"service_credential_binding_guid": guid}, }) } func (client *Client) GetServiceCredentialBindingDetails(guid string) (details resources.ServiceCredentialBindingDetails, warnings Warnings, err error) { _, warnings, err = client.MakeRequest(RequestParams{ - RequestName: internal.GetServiceCredentialBindingDetailsRequest, + RequestName: ccv3internal.GetServiceCredentialBindingDetailsRequest, URIParams: internal.Params{"service_credential_binding_guid": guid}, ResponseBody: &details, }) diff --git a/api/cloudcontroller/ccv3/service_credential_binding_test.go b/api/cloudcontroller/ccv3/service_credential_binding_test.go index f78261ad690..4ab9da8d3aa 100644 --- a/api/cloudcontroller/ccv3/service_credential_binding_test.go +++ b/api/cloudcontroller/ccv3/service_credential_binding_test.go @@ -9,7 +9,8 @@ import ( "code.cloudfoundry.org/cli/api/cloudcontroller/ccerror" . "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/ccv3fakes" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" "code.cloudfoundry.org/cli/types" . "github.com/onsi/ginkgo/v2" @@ -45,7 +46,7 @@ var _ = Describe("Service Credential Bindings", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) Expect(requester.MakeRequestArgsForCall(0)).To(Equal(RequestParams{ - RequestName: internal.PostServiceCredentialBindingRequest, + RequestName: ccv3internal.PostServiceCredentialBindingRequest, RequestBody: binding, })) }) @@ -102,7 +103,7 @@ var _ = Describe("Service Credential Bindings", func() { It("makes the correct call", func() { Expect(requester.MakeListRequestCallCount()).To(Equal(1)) actualParams := requester.MakeListRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.GetServiceCredentialBindingsRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.GetServiceCredentialBindingsRequest)) Expect(actualParams.Query).To(ConsistOf(Query{Key: ServiceInstanceGUIDFilter, Values: []string{"si-1-guid", "si-2-guid", "si-3-guid", "si-4-guid"}})) Expect(actualParams.ResponseBody).To(BeAssignableToTypeOf(resources.ServiceCredentialBinding{})) }) @@ -214,7 +215,7 @@ var _ = Describe("Service Credential Bindings", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) Expect(requester.MakeRequestArgsForCall(0)).To(Equal(RequestParams{ - RequestName: internal.DeleteServiceCredentialBindingRequest, + RequestName: ccv3internal.DeleteServiceCredentialBindingRequest, URIParams: internal.Params{"service_credential_binding_guid": guid}, })) }) @@ -271,7 +272,7 @@ var _ = Describe("Service Credential Bindings", func() { It("makes the correct call", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) actualParams := requester.MakeRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.GetServiceCredentialBindingDetailsRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.GetServiceCredentialBindingDetailsRequest)) Expect(actualParams.URIParams).To(HaveKeyWithValue("service_credential_binding_guid", guid)) Expect(actualParams.ResponseBody).To(BeAssignableToTypeOf(&resources.ServiceCredentialBindingDetails{})) }) diff --git a/api/cloudcontroller/ccv3/service_instance.go b/api/cloudcontroller/ccv3/service_instance.go index 5ab9c84b643..0b604a92eb5 100644 --- a/api/cloudcontroller/ccv3/service_instance.go +++ b/api/cloudcontroller/ccv3/service_instance.go @@ -3,7 +3,8 @@ package ccv3 import ( "code.cloudfoundry.org/cli/api/cloudcontroller/ccerror" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" "code.cloudfoundry.org/cli/types" "code.cloudfoundry.org/cli/util/lookuptable" @@ -20,7 +21,7 @@ func (client *Client) GetServiceInstances(query ...Query) ([]resources.ServiceIn var result []resources.ServiceInstance included, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetServiceInstancesRequest, + RequestName: ccv3internal.GetServiceInstancesRequest, Query: query, ResponseBody: resources.ServiceInstance{}, AppendToList: func(item interface{}) error { @@ -61,7 +62,7 @@ func (client *Client) GetServiceInstanceByNameAndSpace(name, spaceGUID string, q func (client *Client) GetServiceInstanceParameters(serviceInstanceGUID string) (parameters types.JSONObject, warnings Warnings, err error) { _, warnings, err = client.MakeRequest(RequestParams{ - RequestName: internal.GetServiceInstanceParametersRequest, + RequestName: ccv3internal.GetServiceInstanceParametersRequest, URIParams: internal.Params{"service_instance_guid": serviceInstanceGUID}, ResponseBody: ¶meters, }) @@ -71,14 +72,14 @@ func (client *Client) GetServiceInstanceParameters(serviceInstanceGUID string) ( func (client *Client) CreateServiceInstance(serviceInstance resources.ServiceInstance) (JobURL, Warnings, error) { return client.MakeRequest(RequestParams{ - RequestName: internal.PostServiceInstanceRequest, + RequestName: ccv3internal.PostServiceInstanceRequest, RequestBody: serviceInstance, }) } func (client *Client) UpdateServiceInstance(serviceInstanceGUID string, serviceInstanceUpdates resources.ServiceInstance) (JobURL, Warnings, error) { return client.MakeRequest(RequestParams{ - RequestName: internal.PatchServiceInstanceRequest, + RequestName: ccv3internal.PatchServiceInstanceRequest, URIParams: internal.Params{"service_instance_guid": serviceInstanceGUID}, RequestBody: serviceInstanceUpdates, }) @@ -86,7 +87,7 @@ func (client *Client) UpdateServiceInstance(serviceInstanceGUID string, serviceI func (client *Client) DeleteServiceInstance(serviceInstanceGUID string, query ...Query) (JobURL, Warnings, error) { return client.MakeRequest(RequestParams{ - RequestName: internal.DeleteServiceInstanceRequest, + RequestName: ccv3internal.DeleteServiceInstanceRequest, URIParams: internal.Params{"service_instance_guid": serviceInstanceGUID}, Query: query, }) @@ -98,7 +99,7 @@ func (client *Client) ShareServiceInstanceToSpaces(serviceInstanceGUID string, s var responseBody resources.RelationshipList _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostServiceInstanceRelationshipsSharedSpacesRequest, + RequestName: ccv3internal.PostServiceInstanceRelationshipsSharedSpacesRequest, URIParams: internal.Params{"service_instance_guid": serviceInstanceGUID}, RequestBody: resources.RelationshipList{GUIDs: spaceGUIDs}, ResponseBody: &responseBody, @@ -111,7 +112,7 @@ func (client *Client) ShareServiceInstanceToSpaces(serviceInstanceGUID string, s // between the service instance and the shared-to space provided. func (client *Client) UnshareServiceInstanceFromSpace(serviceInstanceGUID string, spaceGUID string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteServiceInstanceRelationshipsSharedSpaceRequest, + RequestName: ccv3internal.DeleteServiceInstanceRelationshipsSharedSpaceRequest, URIParams: internal.Params{"service_instance_guid": serviceInstanceGUID, "space_guid": spaceGUID}, }) @@ -133,7 +134,7 @@ func (client *Client) GetServiceInstanceSharedSpaces(serviceInstanceGUID string) }, } _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetServiceInstanceRelationshipsSharedSpacesRequest, + RequestName: ccv3internal.GetServiceInstanceRelationshipsSharedSpacesRequest, URIParams: internal.Params{"service_instance_guid": serviceInstanceGUID}, Query: query, ResponseBody: &responseBody, @@ -145,7 +146,7 @@ func (client *Client) GetServiceInstanceUsageSummary(serviceInstanceGUID string) var result resources.ServiceInstanceUsageSummaryList _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetServiceInstanceSharedSpacesUsageSummaryRequest, + RequestName: ccv3internal.GetServiceInstanceSharedSpacesUsageSummaryRequest, URIParams: internal.Params{"service_instance_guid": serviceInstanceGUID}, ResponseBody: &result, }) diff --git a/api/cloudcontroller/ccv3/service_instance_test.go b/api/cloudcontroller/ccv3/service_instance_test.go index f4ee3c427cd..9803a6324ec 100644 --- a/api/cloudcontroller/ccv3/service_instance_test.go +++ b/api/cloudcontroller/ccv3/service_instance_test.go @@ -9,7 +9,8 @@ import ( "code.cloudfoundry.org/cli/api/cloudcontroller/ccerror" . "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/ccv3fakes" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" "code.cloudfoundry.org/cli/types" "code.cloudfoundry.org/jsonry" @@ -81,7 +82,7 @@ var _ = Describe("Service Instance", func() { Expect(requester.MakeListRequestCallCount()).To(Equal(1)) actualParams := requester.MakeListRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.GetServiceInstancesRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.GetServiceInstancesRequest)) Expect(actualParams.Query).To(ConsistOf(query)) Expect(actualParams.ResponseBody).To(BeAssignableToTypeOf(resources.ServiceInstance{})) }) @@ -154,7 +155,7 @@ var _ = Describe("Service Instance", func() { It("makes the correct API request", func() { Expect(requester.MakeListRequestCallCount()).To(Equal(1)) actualParams := requester.MakeListRequestArgsForCall(0) - Expect(actualParams.RequestName).To(Equal(internal.GetServiceInstancesRequest)) + Expect(actualParams.RequestName).To(Equal(ccv3internal.GetServiceInstancesRequest)) Expect(actualParams.Query).To(ConsistOf( Query{Key: NameFilter, Values: []string{name}}, Query{Key: SpaceGUIDFilter, Values: []string{spaceGUID}}, @@ -296,7 +297,7 @@ var _ = Describe("Service Instance", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) actualRequest := requester.MakeRequestArgsForCall(0) - Expect(actualRequest.RequestName).To(Equal(internal.GetServiceInstanceParametersRequest)) + Expect(actualRequest.RequestName).To(Equal(ccv3internal.GetServiceInstanceParametersRequest)) Expect(actualRequest.URIParams).To(Equal(internal.Params{"service_instance_guid": guid})) }) @@ -348,7 +349,7 @@ var _ = Describe("Service Instance", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) Expect(requester.MakeRequestArgsForCall(0)).To(Equal(RequestParams{ - RequestName: internal.PostServiceInstanceRequest, + RequestName: ccv3internal.PostServiceInstanceRequest, RequestBody: si, })) }) @@ -418,7 +419,7 @@ var _ = Describe("Service Instance", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) Expect(requester.MakeRequestArgsForCall(0)).To(Equal(RequestParams{ - RequestName: internal.PatchServiceInstanceRequest, + RequestName: ccv3internal.PatchServiceInstanceRequest, URIParams: internal.Params{"service_instance_guid": guid}, RequestBody: serviceInstance, })) @@ -450,7 +451,7 @@ var _ = Describe("Service Instance", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) Expect(requester.MakeRequestArgsForCall(0)).To(Equal(RequestParams{ - RequestName: internal.PatchServiceInstanceRequest, + RequestName: ccv3internal.PatchServiceInstanceRequest, URIParams: internal.Params{"service_instance_guid": guid}, RequestBody: serviceInstance, })) @@ -485,7 +486,7 @@ var _ = Describe("Service Instance", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) Expect(requester.MakeRequestArgsForCall(0)).To(Equal(RequestParams{ - RequestName: internal.DeleteServiceInstanceRequest, + RequestName: ccv3internal.DeleteServiceInstanceRequest, URIParams: internal.Params{"service_instance_guid": guid}, })) }) @@ -548,7 +549,7 @@ var _ = Describe("Service Instance", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) actualRequest := requester.MakeRequestArgsForCall(0) - Expect(actualRequest.RequestName).To(Equal(internal.PostServiceInstanceRelationshipsSharedSpacesRequest)) + Expect(actualRequest.RequestName).To(Equal(ccv3internal.PostServiceInstanceRelationshipsSharedSpacesRequest)) Expect(actualRequest.URIParams).To(Equal(internal.Params{"service_instance_guid": serviceInstanceGUID})) Expect(actualRequest.RequestBody).To(Equal(resources.RelationshipList{ GUIDs: spaceGUIDs, @@ -603,7 +604,7 @@ var _ = Describe("Service Instance", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) Expect(requester.MakeRequestArgsForCall(0)).To(Equal(RequestParams{ - RequestName: internal.DeleteServiceInstanceRelationshipsSharedSpaceRequest, + RequestName: ccv3internal.DeleteServiceInstanceRelationshipsSharedSpaceRequest, URIParams: internal.Params{ "service_instance_guid": serviceInstanceGUID, "space_guid": spaceGUID}, @@ -653,7 +654,7 @@ var _ = Describe("Service Instance", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) actualRequest := requester.MakeRequestArgsForCall(0) - Expect(actualRequest.RequestName).To(Equal(internal.GetServiceInstanceRelationshipsSharedSpacesRequest)) + Expect(actualRequest.RequestName).To(Equal(ccv3internal.GetServiceInstanceRelationshipsSharedSpacesRequest)) Expect(actualRequest.URIParams).To(Equal(internal.Params{"service_instance_guid": serviceInstanceGUID})) Expect(actualRequest.Query).To(ConsistOf( Query{ @@ -766,7 +767,7 @@ var _ = Describe("Service Instance", func() { Expect(requester.MakeRequestCallCount()).To(Equal(1)) actualRequest := requester.MakeRequestArgsForCall(0) - Expect(actualRequest.RequestName).To(Equal(internal.GetServiceInstanceSharedSpacesUsageSummaryRequest)) + Expect(actualRequest.RequestName).To(Equal(ccv3internal.GetServiceInstanceSharedSpacesUsageSummaryRequest)) Expect(actualRequest.URIParams).To(Equal(internal.Params{"service_instance_guid": serviceInstanceGUID})) }) diff --git a/api/cloudcontroller/ccv3/service_offering.go b/api/cloudcontroller/ccv3/service_offering.go index c5ce0cba2ea..28365e4a094 100644 --- a/api/cloudcontroller/ccv3/service_offering.go +++ b/api/cloudcontroller/ccv3/service_offering.go @@ -2,7 +2,8 @@ package ccv3 import ( "code.cloudfoundry.org/cli/api/cloudcontroller/ccerror" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" "code.cloudfoundry.org/cli/util/lookuptable" ) @@ -14,7 +15,7 @@ func (client *Client) GetServiceOfferings(query ...Query) ([]resources.ServiceOf query = append(query, Query{Key: FieldsServiceBroker, Values: []string{"name", "guid"}}) included, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetServiceOfferingsRequest, + RequestName: ccv3internal.GetServiceOfferingsRequest, Query: query, ResponseBody: resources.ServiceOffering{}, AppendToList: func(item interface{}) error { @@ -40,7 +41,7 @@ func (client *Client) GetServiceOfferingByGUID(guid string) (resources.ServiceOf var result resources.ServiceOffering _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetServiceOfferingRequest, + RequestName: ccv3internal.GetServiceOfferingRequest, URIParams: internal.Params{"service_offering_guid": guid}, ResponseBody: &result, }) @@ -81,7 +82,7 @@ func (client *Client) GetServiceOfferingByNameAndBroker(serviceOfferingName, ser func (client *Client) PurgeServiceOffering(serviceOfferingGUID string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteServiceOfferingRequest, + RequestName: ccv3internal.DeleteServiceOfferingRequest, URIParams: internal.Params{"service_offering_guid": serviceOfferingGUID}, Query: []Query{{Key: Purge, Values: []string{"true"}}}, }) diff --git a/api/cloudcontroller/ccv3/service_plan.go b/api/cloudcontroller/ccv3/service_plan.go index e61a462e6dd..1a681d4889e 100644 --- a/api/cloudcontroller/ccv3/service_plan.go +++ b/api/cloudcontroller/ccv3/service_plan.go @@ -3,7 +3,8 @@ package ccv3 import ( "code.cloudfoundry.org/cli/api/cloudcontroller/ccerror" "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant" - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" "code.cloudfoundry.org/cli/util/lookuptable" ) @@ -16,7 +17,7 @@ func (client *Client) GetServicePlanByGUID(guid string) (resources.ServicePlan, var result resources.ServicePlan _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetServicePlanRequest, + RequestName: ccv3internal.GetServicePlanRequest, URIParams: internal.Params{"service_plan_guid": guid}, ResponseBody: &result, }) @@ -34,7 +35,7 @@ func (client *Client) getServicePlans(query ...Query) ([]resources.ServicePlan, var plans []resources.ServicePlan included, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetServicePlansRequest, + RequestName: ccv3internal.GetServicePlansRequest, Query: query, ResponseBody: resources.ServicePlan{}, AppendToList: func(item interface{}) error { diff --git a/api/cloudcontroller/ccv3/service_plan_visibility.go b/api/cloudcontroller/ccv3/service_plan_visibility.go index 89fb79b21f7..3fe13c32a2c 100644 --- a/api/cloudcontroller/ccv3/service_plan_visibility.go +++ b/api/cloudcontroller/ccv3/service_plan_visibility.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -9,7 +10,7 @@ func (client *Client) GetServicePlanVisibility(servicePlanGUID string) (resource var result resources.ServicePlanVisibility _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetServicePlanVisibilityRequest, + RequestName: ccv3internal.GetServicePlanVisibilityRequest, URIParams: internal.Params{"service_plan_guid": servicePlanGUID}, ResponseBody: &result, }) @@ -21,7 +22,7 @@ func (client *Client) UpdateServicePlanVisibility(servicePlanGUID string, planVi var result resources.ServicePlanVisibility _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostServicePlanVisibilityRequest, + RequestName: ccv3internal.PostServicePlanVisibilityRequest, URIParams: internal.Params{"service_plan_guid": servicePlanGUID}, RequestBody: planVisibility, ResponseBody: &result, @@ -33,7 +34,7 @@ func (client *Client) UpdateServicePlanVisibility(servicePlanGUID string, planVi func (client *Client) DeleteServicePlanVisibility(servicePlanGUID, organizationGUID string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteServicePlanVisibilityRequest, + RequestName: ccv3internal.DeleteServicePlanVisibilityRequest, URIParams: internal.Params{"service_plan_guid": servicePlanGUID, "organization_guid": organizationGUID}, }) diff --git a/api/cloudcontroller/ccv3/sidecar.go b/api/cloudcontroller/ccv3/sidecar.go index f9e59c92a25..1b3b1efc7e0 100644 --- a/api/cloudcontroller/ccv3/sidecar.go +++ b/api/cloudcontroller/ccv3/sidecar.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -9,7 +10,7 @@ func (client *Client) GetProcessSidecars(processGuid string) ([]resources.Sideca var sidecars []resources.Sidecar _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetProcessSidecarsRequest, + RequestName: ccv3internal.GetProcessSidecarsRequest, URIParams: internal.Params{"process_guid": processGuid}, ResponseBody: resources.Sidecar{}, AppendToList: func(item interface{}) error { diff --git a/api/cloudcontroller/ccv3/space.go b/api/cloudcontroller/ccv3/space.go index cad31730bcb..cf954d1ea27 100644 --- a/api/cloudcontroller/ccv3/space.go +++ b/api/cloudcontroller/ccv3/space.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -9,7 +10,7 @@ func (client *Client) CreateSpace(space resources.Space) (resources.Space, Warni var responseBody resources.Space _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostSpaceRequest, + RequestName: ccv3internal.PostSpaceRequest, RequestBody: space, ResponseBody: &responseBody, }) @@ -19,7 +20,7 @@ func (client *Client) CreateSpace(space resources.Space) (resources.Space, Warni func (client *Client) DeleteSpace(spaceGUID string) (JobURL, Warnings, error) { jobURL, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteSpaceRequest, + RequestName: ccv3internal.DeleteSpaceRequest, URIParams: internal.Params{"space_guid": spaceGUID}, }) @@ -31,7 +32,7 @@ func (client *Client) GetSpaces(query ...Query) ([]resources.Space, IncludedReso var returnedResources []resources.Space includedResources, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetSpacesRequest, + RequestName: ccv3internal.GetSpacesRequest, Query: query, ResponseBody: resources.Space{}, AppendToList: func(item interface{}) error { @@ -51,7 +52,7 @@ func (client *Client) UpdateSpace(space resources.Space) (resources.Space, Warni var responseBody resources.Space _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchSpaceRequest, + RequestName: ccv3internal.PatchSpaceRequest, URIParams: internal.Params{"space_guid": spaceGUID}, RequestBody: space, ResponseBody: &responseBody, diff --git a/api/cloudcontroller/ccv3/space_feature.go b/api/cloudcontroller/ccv3/space_feature.go index 462295bc4e3..b93b2a74a39 100644 --- a/api/cloudcontroller/ccv3/space_feature.go +++ b/api/cloudcontroller/ccv3/space_feature.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -9,7 +10,7 @@ func (client *Client) GetSpaceFeature(spaceGUID string, featureName string) (boo var responseBody resources.SpaceFeature _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetSpaceFeatureRequest, + RequestName: ccv3internal.GetSpaceFeatureRequest, URIParams: internal.Params{"space_guid": spaceGUID, "feature": featureName}, ResponseBody: &responseBody, }) @@ -19,7 +20,7 @@ func (client *Client) GetSpaceFeature(spaceGUID string, featureName string) (boo func (client *Client) UpdateSpaceFeature(spaceGUID string, enabled bool, featureName string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchSpaceFeaturesRequest, + RequestName: ccv3internal.PatchSpaceFeaturesRequest, URIParams: internal.Params{"space_guid": spaceGUID, "feature": featureName}, RequestBody: struct { Enabled bool `json:"enabled"` diff --git a/api/cloudcontroller/ccv3/space_quota.go b/api/cloudcontroller/ccv3/space_quota.go index b8fb01a176f..5cbbdf9a911 100644 --- a/api/cloudcontroller/ccv3/space_quota.go +++ b/api/cloudcontroller/ccv3/space_quota.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -9,7 +10,7 @@ func (client Client) ApplySpaceQuota(quotaGUID string, spaceGUID string) (resour var responseBody resources.RelationshipList _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostSpaceQuotaRelationshipsRequest, + RequestName: ccv3internal.PostSpaceQuotaRelationshipsRequest, URIParams: internal.Params{"quota_guid": quotaGUID}, RequestBody: resources.RelationshipList{GUIDs: []string{spaceGUID}}, ResponseBody: &responseBody, @@ -22,7 +23,7 @@ func (client Client) CreateSpaceQuota(spaceQuota resources.SpaceQuota) (resource var responseBody resources.SpaceQuota _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostSpaceQuotaRequest, + RequestName: ccv3internal.PostSpaceQuotaRequest, RequestBody: spaceQuota, ResponseBody: &responseBody, }) @@ -32,7 +33,7 @@ func (client Client) CreateSpaceQuota(spaceQuota resources.SpaceQuota) (resource func (client Client) DeleteSpaceQuota(spaceQuotaGUID string) (JobURL, Warnings, error) { jobURL, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteSpaceQuotaRequest, + RequestName: ccv3internal.DeleteSpaceQuotaRequest, URIParams: internal.Params{"quota_guid": spaceQuotaGUID}, }) @@ -43,7 +44,7 @@ func (client Client) GetSpaceQuota(spaceQuotaGUID string) (resources.SpaceQuota, var responseBody resources.SpaceQuota _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetSpaceQuotaRequest, + RequestName: ccv3internal.GetSpaceQuotaRequest, URIParams: internal.Params{"quota_guid": spaceQuotaGUID}, ResponseBody: &responseBody, }) @@ -55,7 +56,7 @@ func (client *Client) GetSpaceQuotas(query ...Query) ([]resources.SpaceQuota, Wa var spaceQuotas []resources.SpaceQuota _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetSpaceQuotasRequest, + RequestName: ccv3internal.GetSpaceQuotasRequest, Query: query, ResponseBody: resources.SpaceQuota{}, AppendToList: func(item interface{}) error { @@ -69,7 +70,7 @@ func (client *Client) GetSpaceQuotas(query ...Query) ([]resources.SpaceQuota, Wa func (client *Client) UnsetSpaceQuota(spaceQuotaGUID, spaceGUID string) (Warnings, error) { _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteSpaceQuotaFromSpaceRequest, + RequestName: ccv3internal.DeleteSpaceQuotaFromSpaceRequest, URIParams: internal.Params{"quota_guid": spaceQuotaGUID, "space_guid": spaceGUID}, }) @@ -83,7 +84,7 @@ func (client *Client) UpdateSpaceQuota(spaceQuota resources.SpaceQuota) (resourc var responseBody resources.SpaceQuota _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PatchSpaceQuotaRequest, + RequestName: ccv3internal.PatchSpaceQuotaRequest, URIParams: internal.Params{"quota_guid": spaceQuotaGUID}, RequestBody: spaceQuota, ResponseBody: &responseBody, diff --git a/api/cloudcontroller/ccv3/task.go b/api/cloudcontroller/ccv3/task.go index 91c99814eaa..fe0b1ea34db 100644 --- a/api/cloudcontroller/ccv3/task.go +++ b/api/cloudcontroller/ccv3/task.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -11,7 +12,7 @@ func (client *Client) CreateApplicationTask(appGUID string, task resources.Task) var responseBody resources.Task _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostApplicationTasksRequest, + RequestName: ccv3internal.PostApplicationTasksRequest, URIParams: internal.Params{"app_guid": appGUID}, RequestBody: task, ResponseBody: &responseBody, @@ -36,7 +37,7 @@ func (client *Client) GetApplicationTasks(appGUID string, query ...Query) ([]res } _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetApplicationTasksRequest, + RequestName: ccv3internal.GetApplicationTasksRequest, URIParams: internal.Params{"app_guid": appGUID}, Query: query, ResponseBody: resources.Task{}, @@ -54,7 +55,7 @@ func (client *Client) UpdateTaskCancel(taskGUID string) (resources.Task, Warning var responseBody resources.Task _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PutTaskCancelRequest, + RequestName: ccv3internal.PutTaskCancelRequest, URIParams: internal.Params{ "task_guid": taskGUID, }, @@ -68,7 +69,7 @@ func (client *Client) GetTask(guid string) (resources.Task, Warnings, error) { var responseBody resources.Task _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetTaskRequest, + RequestName: ccv3internal.GetTaskRequest, URIParams: internal.Params{ "task_guid": guid, }, diff --git a/api/cloudcontroller/ccv3/user.go b/api/cloudcontroller/ccv3/user.go index 7b2aa8edb20..d919c36b9d9 100644 --- a/api/cloudcontroller/ccv3/user.go +++ b/api/cloudcontroller/ccv3/user.go @@ -1,7 +1,8 @@ package ccv3 import ( - "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + ccv3internal "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" + "code.cloudfoundry.org/cli/api/internal" "code.cloudfoundry.org/cli/resources" ) @@ -16,7 +17,7 @@ func (client *Client) CreateUser(uaaUserID string) (resources.User, Warnings, er var responseBody resources.User _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.PostUserRequest, + RequestName: ccv3internal.PostUserRequest, RequestBody: user, ResponseBody: &responseBody, }) @@ -26,7 +27,7 @@ func (client *Client) CreateUser(uaaUserID string) (resources.User, Warnings, er func (client *Client) DeleteUser(uaaUserID string) (JobURL, Warnings, error) { jobURL, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.DeleteUserRequest, + RequestName: ccv3internal.DeleteUserRequest, URIParams: internal.Params{"user_guid": uaaUserID}, }) @@ -37,7 +38,7 @@ func (client *Client) GetUser(userGUID string) (resources.User, Warnings, error) var responseBody resources.User _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.GetUserRequest, + RequestName: ccv3internal.GetUserRequest, URIParams: internal.Params{"user_guid": userGUID}, ResponseBody: &responseBody, }) @@ -49,7 +50,7 @@ func (client *Client) GetUsers(query ...Query) ([]resources.User, Warnings, erro var users []resources.User _, warnings, err := client.MakeListRequest(RequestParams{ - RequestName: internal.GetUsersRequest, + RequestName: ccv3internal.GetUsersRequest, Query: query, ResponseBody: resources.User{}, AppendToList: func(item interface{}) error { @@ -65,7 +66,7 @@ func (client *Client) WhoAmI() (resources.K8sUser, Warnings, error) { var user resources.K8sUser _, warnings, err := client.MakeRequest(RequestParams{ - RequestName: internal.WhoAmI, + RequestName: ccv3internal.WhoAmI, ResponseBody: &user, }) diff --git a/api/cloudcontroller/ccv3/internal/internal_suite_test.go b/api/internal/internal_suite_test.go similarity index 100% rename from api/cloudcontroller/ccv3/internal/internal_suite_test.go rename to api/internal/internal_suite_test.go diff --git a/api/cloudcontroller/ccv3/internal/real_time.go b/api/internal/real_time.go similarity index 100% rename from api/cloudcontroller/ccv3/internal/real_time.go rename to api/internal/real_time.go diff --git a/api/cloudcontroller/ccv3/internal/routing.go b/api/internal/routing.go similarity index 100% rename from api/cloudcontroller/ccv3/internal/routing.go rename to api/internal/routing.go diff --git a/api/cloudcontroller/ccv3/internal/routing_test.go b/api/internal/routing_test.go similarity index 79% rename from api/cloudcontroller/ccv3/internal/routing_test.go rename to api/internal/routing_test.go index 59b52b3f74a..a5935374ffd 100644 --- a/api/cloudcontroller/ccv3/internal/routing_test.go +++ b/api/internal/routing_test.go @@ -3,26 +3,25 @@ package internal_test import ( "net/http" - . "code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/internal" - + "code.cloudfoundry.org/cli/api/internal" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) var _ = Describe("Routing", func() { Describe("Route", func() { - var route Route + var route internal.Route Describe("CreatePath", func() { BeforeEach(func() { - route = Route{ + route = internal.Route{ Method: "GET", Path: "/a/path/:param/with/:many_things/:many/in/:it", } }) It("should return a url with all :entries populated by the passed in hash", func() { - Expect(route.CreatePath(Params{ + Expect(route.CreatePath(internal.Params{ "param": "1", "many_things": "2", "many": "a space", @@ -32,7 +31,7 @@ var _ = Describe("Routing", func() { When("the hash is missing params", func() { It("should error", func() { - _, err := route.CreatePath(Params{ + _, err := route.CreatePath(internal.Params{ "param": "1", "many": "2", "it": "4", @@ -43,7 +42,7 @@ var _ = Describe("Routing", func() { When("the hash has extra params", func() { It("should totally not care", func() { - Expect(route.CreatePath(Params{ + Expect(route.CreatePath(internal.Params{ "param": "1", "many_things": "2", "many": "a space", @@ -55,11 +54,11 @@ var _ = Describe("Routing", func() { Context("with a trailing slash", func() { It("should work", func() { - route = Route{ + route = internal.Route{ Method: "GET", Path: "/a/path/:param/", } - Expect(route.CreatePath(Params{ + Expect(route.CreatePath(internal.Params{ "param": "1", })).Should(Equal(`/a/path/1/`)) }) @@ -69,13 +68,13 @@ var _ = Describe("Routing", func() { Describe("Router", func() { var ( - router *Router - routes map[string]Route + router *internal.Router + routes map[string]internal.Route baseURL string ) JustBeforeEach(func() { - router = NewRouter(routes, baseURL) + router = internal.NewRouter(routes, baseURL) }) Describe("CreateRequest", func() { @@ -86,14 +85,14 @@ var _ = Describe("Routing", func() { badRouteName = "orange" baseURL = "https://foo.bar.baz/this/is" - routes = map[string]Route{ + routes = map[string]internal.Route{ routeName: {Path: "/very/good/:name", Method: http.MethodGet}, badRouteName: {Path: "/very/bad", Method: http.MethodGet}, } }) It("returns a request", func() { - request, err := router.CreateRequest(routeName, Params{"name": "Henry the 8th"}, nil) + request, err := router.CreateRequest(routeName, internal.Params{"name": "Henry the 8th"}, nil) Expect(err).ToNot(HaveOccurred()) Expect(request.URL.String()).To(Equal("https://foo.bar.baz/this/is/very/good/Henry%2520the%25208th")) }) diff --git a/api/router/client.go b/api/router/client.go index b6ceeefe46f..cebe0828db5 100644 --- a/api/router/client.go +++ b/api/router/client.go @@ -5,16 +5,15 @@ import ( "fmt" "runtime" - "code.cloudfoundry.org/cli/api/router/internal" - - "github.com/tedsuo/rata" + "code.cloudfoundry.org/cli/api/internal" + rinternal "code.cloudfoundry.org/cli/api/router/internal" ) // Client is a client that can be used to talk to a Cloud Controller's V2 // Endpoints. type Client struct { connection Connection - router *rata.RequestGenerator + router *internal.Router userAgent string } @@ -48,7 +47,7 @@ func NewClient(config Config) *Client { client := Client{ userAgent: userAgent, - router: rata.NewRequestGenerator(config.RoutingEndpoint, internal.APIRoutes), + router: internal.NewRouter(rinternal.APIRoutes, config.RoutingEndpoint), connection: NewConnection(config.ConnectionConfig), } diff --git a/api/router/internal/api_routes.go b/api/router/internal/api_routes.go index ad7a8dccd7e..206a8976900 100644 --- a/api/router/internal/api_routes.go +++ b/api/router/internal/api_routes.go @@ -3,7 +3,7 @@ package internal import ( "net/http" - "github.com/tedsuo/rata" + "code.cloudfoundry.org/cli/api/internal" ) // Naming convention: @@ -20,6 +20,6 @@ const ( // APIRoutes is a list of routes used by the rata library to construct request // URLs. -var APIRoutes = rata.Routes{ - {Path: "/v1/router_groups", Method: http.MethodGet, Name: GetRouterGroups}, +var APIRoutes = map[string]internal.Route{ + GetRouterGroups: {Path: "/v1/router_groups", Method: http.MethodGet}, } diff --git a/api/router/request.go b/api/router/request.go index a269bd349ca..a1d627d6e37 100644 --- a/api/router/request.go +++ b/api/router/request.go @@ -5,7 +5,7 @@ import ( "net/http" "net/url" - "github.com/tedsuo/rata" + "code.cloudfoundry.org/cli/api/internal" ) // Request represents the request of the router @@ -56,7 +56,7 @@ type requestOptions struct { func (client Client) newHTTPRequest(passedRequest requestOptions) (*Request, error) { request, err := client.router.CreateRequest( passedRequest.RequestName, - rata.Params(passedRequest.URIParams), + internal.Params(passedRequest.URIParams), passedRequest.Body, ) diff --git a/cf/appfiles/app_files_test.go b/cf/appfiles/app_files_test.go index 63e79ce3571..3a3910c7254 100644 --- a/cf/appfiles/app_files_test.go +++ b/cf/appfiles/app_files_test.go @@ -8,10 +8,9 @@ import ( "strings" "code.cloudfoundry.org/cli/cf/appfiles" - uuid "github.com/nu7hatch/gouuid" - "code.cloudfoundry.org/cli/cf/models" "code.cloudfoundry.org/gofileutils/fileutils" + "github.com/google/uuid" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" @@ -215,9 +214,7 @@ var _ = Describe("AppFiles", func() { tmpDir, err = ioutil.TempDir("", "untraversable-test") Expect(err).NotTo(HaveOccurred()) - guid, err := uuid.NewV4() - Expect(err).NotTo(HaveOccurred()) - + guid := uuid.New() untraversableDirName = guid.String() untraversableDirPath := filepath.Join(tmpDir, untraversableDirName) diff --git a/cf/commands/create_app_manifest_test.go b/cf/commands/create_app_manifest_test.go index ad3b71d9b76..f2d8804e23a 100644 --- a/cf/commands/create_app_manifest_test.go +++ b/cf/commands/create_app_manifest_test.go @@ -3,7 +3,10 @@ package commands_test import ( "errors" "fmt" + "os" + "code.cloudfoundry.org/cli/cf/api/apifakes" + "code.cloudfoundry.org/cli/cf/api/stacks/stacksfakes" "code.cloudfoundry.org/cli/cf/commandregistry" "code.cloudfoundry.org/cli/cf/commands" "code.cloudfoundry.org/cli/cf/configuration/coreconfig" @@ -12,16 +15,10 @@ import ( "code.cloudfoundry.org/cli/cf/models" "code.cloudfoundry.org/cli/cf/requirements" "code.cloudfoundry.org/cli/cf/requirements/requirementsfakes" - - "code.cloudfoundry.org/cli/cf/api/apifakes" - "code.cloudfoundry.org/cli/cf/api/stacks/stacksfakes" testconfig "code.cloudfoundry.org/cli/cf/util/testhelpers/configuration" - testterm "code.cloudfoundry.org/cli/cf/util/testhelpers/terminal" - - "os" - . "code.cloudfoundry.org/cli/cf/util/testhelpers/matchers" - uuid "github.com/nu7hatch/gouuid" + testterm "code.cloudfoundry.org/cli/cf/util/testhelpers/terminal" + uuid "github.com/google/uuid" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) @@ -47,8 +44,7 @@ var _ = Describe("CreateAppManifest", func() { ) BeforeEach(func() { - rand, err := uuid.NewV4() - Expect(err).ToNot(HaveOccurred()) + rand := uuid.New() appName = fmt.Sprintf("app-name-%s", rand) ui = &testterm.FakeUI{} configRepo = testconfig.NewRepositoryWithDefaults() diff --git a/command/plugin/shared/progress_bar_proxy_reader.go b/command/plugin/shared/progress_bar_proxy_reader.go index 0505f83a16f..791eaf33f80 100644 --- a/command/plugin/shared/progress_bar_proxy_reader.go +++ b/command/plugin/shared/progress_bar_proxy_reader.go @@ -3,7 +3,7 @@ package shared import ( "io" - pb "gopkg.in/cheggaaa/pb.v1" + "github.com/cheggaaa/pb/v3" ) // ProgressBarProxyReader wraps a progress bar in a ProxyReader interface. @@ -17,8 +17,9 @@ func (p ProgressBarProxyReader) Wrap(reader io.Reader) io.ReadCloser { } func (p *ProgressBarProxyReader) Start(size int64) { - p.bar = pb.New(int(size)).SetUnits(pb.U_BYTES) - p.bar.Output = p.writer + p.bar = pb.New(int(size)) + p.bar.Set(pb.Bytes, true) + p.bar.SetWriter(p.writer) p.bar.Start() } diff --git a/command/v7/marketplace_command_test.go b/command/v7/marketplace_command_test.go index cf27c435c36..156d83b60f3 100644 --- a/command/v7/marketplace_command_test.go +++ b/command/v7/marketplace_command_test.go @@ -1,6 +1,8 @@ package v7_test import ( + "errors" + "code.cloudfoundry.org/cli/actor/v7action" "code.cloudfoundry.org/cli/command/commandfakes" "code.cloudfoundry.org/cli/command/translatableerror" @@ -13,7 +15,6 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" . "github.com/onsi/gomega/gbytes" - "github.com/pkg/errors" ) var _ = Describe("marketplace command", func() { diff --git a/command/v7/v7_suite_test.go b/command/v7/v7_suite_test.go index 8a1af2c03a2..c66e62bc1a1 100644 --- a/command/v7/v7_suite_test.go +++ b/command/v7/v7_suite_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - uuid "github.com/nu7hatch/gouuid" + uuid "github.com/google/uuid" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" log "github.com/sirupsen/logrus" @@ -23,11 +23,7 @@ var _ = BeforeEach(func() { // RandomString provides a random string func RandomString(prefix string) string { - guid, err := uuid.NewV4() - if err != nil { - panic(err) - } - + guid := uuid.New() return prefix + "-" + guid.String() } diff --git a/go.mod b/go.mod index 2ed8a5891b4..c91f2d8d605 100644 --- a/go.mod +++ b/go.mod @@ -18,32 +18,30 @@ require ( code.cloudfoundry.org/ykk v0.0.0-20170424192843-e4df4ce2fd4d github.com/SermoDigital/jose v0.9.2-0.20161205224733-f6df55f235c2 github.com/blang/semver/v4 v4.0.0 + github.com/cheggaaa/pb/v3 v3.1.6-0.20241030110445-d0803d4621f5 github.com/cloudfoundry/bosh-cli v6.4.1+incompatible github.com/creack/pty v1.1.24 github.com/cyphar/filepath-securejoin v0.3.5 github.com/distribution/reference v0.6.0 github.com/fatih/color v1.18.0 github.com/google/go-querystring v1.1.0 + github.com/google/uuid v1.6.0 github.com/jessevdk/go-flags v1.6.1 github.com/lunixbochs/vtclean v1.0.0 github.com/mattn/go-colorable v0.1.13 github.com/mattn/go-runewidth v0.0.16 github.com/maxbrunsfeld/counterfeiter/v6 v6.10.0 github.com/moby/term v0.5.0 - github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d github.com/onsi/ginkgo/v2 v2.22.0 github.com/onsi/gomega v1.36.1 - github.com/pkg/errors v0.9.1 github.com/sabhiram/go-gitignore v0.0.0-20171017070213-362f9845770f github.com/sajari/fuzzy v1.0.0 github.com/sirupsen/logrus v1.9.3 - github.com/tedsuo/rata v1.0.1-0.20170830210128-07d200713958 github.com/vito/go-interact v0.0.0-20171111012221-fa338ed9e9ec golang.org/x/crypto v0.31.0 golang.org/x/net v0.32.0 golang.org/x/term v0.27.0 golang.org/x/text v0.21.0 - gopkg.in/cheggaaa/pb.v1 v1.0.28 gopkg.in/yaml.v2 v2.4.0 k8s.io/apimachinery v0.32.0 k8s.io/client-go v0.32.0 @@ -52,6 +50,7 @@ require ( require ( code.cloudfoundry.org/inigo v0.0.0-20230612153013-b300679e6ed6 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect + github.com/VividCortex/ewma v1.2.0 // indirect github.com/bmatcuk/doublestar v1.3.4 // indirect github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40 // indirect github.com/charlievieth/fs v0.0.3 // indirect @@ -77,6 +76,7 @@ require ( github.com/openzipkin/zipkin-go v0.4.3 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/spf13/pflag v1.0.5 // indirect + github.com/tedsuo/rata v1.0.0 // indirect github.com/x448/float16 v0.8.4 // indirect golang.org/x/mod v0.22.0 // indirect golang.org/x/oauth2 v0.23.0 // indirect diff --git a/go.sum b/go.sum index f461c63b35a..4c766de928b 100644 --- a/go.sum +++ b/go.sum @@ -35,6 +35,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03 github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/SermoDigital/jose v0.9.2-0.20161205224733-f6df55f235c2 h1:koK7z0nSsRiRiBWwa+E714Puh+DO+ZRdIyAXiXzL+lg= github.com/SermoDigital/jose v0.9.2-0.20161205224733-f6df55f235c2/go.mod h1:ARgCUhI1MHQH+ONky/PAtmVHQrP5JlGY0F3poXOp/fA= +github.com/VividCortex/ewma v1.2.0 h1:f58SaIzcDXrSy3kWaHNvuJgJ3Nmz59Zji6XoJR/q1ow= +github.com/VividCortex/ewma v1.2.0/go.mod h1:nz4BbCtbLyFDeC9SUHbtcT5644juEuWfUAUnGx7j5l4= github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= @@ -45,6 +47,8 @@ github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40 h1:y4B3+GPxKlrigF1ha github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= github.com/charlievieth/fs v0.0.3 h1:3lZQXTj4PbE81CVPwALSn+JoyCNXkZgORHN6h2XHGlg= github.com/charlievieth/fs v0.0.3/go.mod h1:hD4sRzto1Hw8zCua76tNVKZxaeZZr1RiKftjAJQRLLo= +github.com/cheggaaa/pb/v3 v3.1.6-0.20241030110445-d0803d4621f5 h1:0WNR2UJeJpJs1EmPSa7nxmCeCyXrf8wjegGddFcgeCM= +github.com/cheggaaa/pb/v3 v3.1.6-0.20241030110445-d0803d4621f5/go.mod h1:zg5MTEnDmw0iIbV8UYIwRA7NiCpf4FBVCXGZUtlDlJQ= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= @@ -245,8 +249,8 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/tedsuo/ifrit v0.0.0-20230516164442-7862c310ad26 h1:mWCRvpoEMVlslxEvvptKgIUb35va9yj9Oq5wGw/er5I= github.com/tedsuo/ifrit v0.0.0-20230516164442-7862c310ad26/go.mod h1:0uD3VMXkZ7Bw0ojGCwDzebBBzPBXtzEZeXai+56BLX4= -github.com/tedsuo/rata v1.0.1-0.20170830210128-07d200713958 h1:mueRRuRjR35dEOkHdhpoRcruNgBz0ohG659HxxmcAwA= -github.com/tedsuo/rata v1.0.1-0.20170830210128-07d200713958/go.mod h1:X47ELzhOoLbfFIY0Cql9P6yo3Cdwf2CMX3FVZxRzJPc= +github.com/tedsuo/rata v1.0.0 h1:Sf9aZrYy6ElSTncjnGkyC2yuVvz5YJetBIUKJ4CmeKE= +github.com/tedsuo/rata v1.0.0/go.mod h1:X47ELzhOoLbfFIY0Cql9P6yo3Cdwf2CMX3FVZxRzJPc= github.com/unrolled/secure v0.0.0-20180416205222-a1cf62cc2159/go.mod h1:mnPT77IAdsi/kV7+Es7y+pXALeV3h7G6dQF6mNYjcLA= github.com/vito/go-interact v0.0.0-20171111012221-fa338ed9e9ec h1:Klu98tQ9Z1t23gvC7p7sCmvxkZxLhBHLNyrUPsWsYFg= github.com/vito/go-interact v0.0.0-20171111012221-fa338ed9e9ec/go.mod h1:wPlfmglZmRWMYv/qJy3P+fK/UnoQB5ISk4txfNd9tDo= @@ -374,8 +378,6 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/cheggaaa/pb.v1 v1.0.28 h1:n1tBJnnK2r7g9OW2btFH91V92STTUevLXYFb8gy9EMk= -gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= diff --git a/integration/assets/hydrabroker/app/helpers.go b/integration/assets/hydrabroker/app/helpers.go index 0ccbbb945ce..d5b680333e3 100644 --- a/integration/assets/hydrabroker/app/helpers.go +++ b/integration/assets/hydrabroker/app/helpers.go @@ -7,8 +7,8 @@ import ( "net/http" "code.cloudfoundry.org/cli/integration/assets/hydrabroker/store" + uuid "github.com/google/uuid" "github.com/gorilla/mux" - uuid "github.com/nu7hatch/gouuid" ) func respondWithJSON(w http.ResponseWriter, data interface{}) error { @@ -41,9 +41,6 @@ func readGUIDs(r *http.Request) (requestGUIDs, error) { } func mustGUID() string { - rawGUID, err := uuid.NewV4() - if err != nil { - panic(err) - } + rawGUID := uuid.New() return rawGUID.String() } diff --git a/integration/assets/hydrabroker/database/database.go b/integration/assets/hydrabroker/database/database.go index 8ea704bfb30..e8374608149 100644 --- a/integration/assets/hydrabroker/database/database.go +++ b/integration/assets/hydrabroker/database/database.go @@ -4,7 +4,7 @@ import ( "fmt" "sync" - uuid "github.com/nu7hatch/gouuid" + uuid "github.com/google/uuid" ) type ID string @@ -15,10 +15,7 @@ type Database struct { } func NewID() ID { - rawGUID, err := uuid.NewV4() - if err != nil { - panic(err) - } + rawGUID := uuid.New() return ID(rawGUID.String()) } diff --git a/integration/assets/hydrabroker/integrationtest/integrationtest_test.go b/integration/assets/hydrabroker/integrationtest/integrationtest_test.go index db73f73c02b..5f4af8b464e 100644 --- a/integration/assets/hydrabroker/integrationtest/integrationtest_test.go +++ b/integration/assets/hydrabroker/integrationtest/integrationtest_test.go @@ -14,7 +14,7 @@ import ( "code.cloudfoundry.org/cli/integration/assets/hydrabroker/app" "code.cloudfoundry.org/cli/integration/assets/hydrabroker/config" "code.cloudfoundry.org/cli/integration/assets/hydrabroker/resources" - uuid2 "github.com/nu7hatch/gouuid" + "github.com/google/uuid" "github.com/pivotal-cf/brokerapi/v7/domain/apiresponses" ) @@ -654,9 +654,7 @@ func randomConfiguration() config.BrokerConfiguration { } func randomString() string { - uuid, err := uuid2.NewV4() - Expect(err).NotTo(HaveOccurred()) - return uuid.String() + return uuid.New().String() } func toJSON(input interface{}) io.Reader { diff --git a/integration/assets/hydrabroker/store/bindings_test.go b/integration/assets/hydrabroker/store/bindings_test.go index fe30b42ef50..9e10cc4c655 100644 --- a/integration/assets/hydrabroker/store/bindings_test.go +++ b/integration/assets/hydrabroker/store/bindings_test.go @@ -6,7 +6,7 @@ import ( "code.cloudfoundry.org/cli/integration/assets/hydrabroker/config" "code.cloudfoundry.org/cli/integration/assets/hydrabroker/resources" "code.cloudfoundry.org/cli/integration/assets/hydrabroker/store" - uuid "github.com/nu7hatch/gouuid" + "github.com/google/uuid" ) var _ = Describe("Bindings", func() { @@ -17,11 +17,7 @@ var _ = Describe("Bindings", func() { ) randomID := func() store.BindingID { - rawGUID, err := uuid.NewV4() - if err != nil { - panic(err) - } - + rawGUID := uuid.New() return store.BindingID(rawGUID.String()) } diff --git a/integration/assets/hydrabroker/store/instances_test.go b/integration/assets/hydrabroker/store/instances_test.go index 0fb45a2da1f..86795816887 100644 --- a/integration/assets/hydrabroker/store/instances_test.go +++ b/integration/assets/hydrabroker/store/instances_test.go @@ -6,7 +6,7 @@ import ( "code.cloudfoundry.org/cli/integration/assets/hydrabroker/config" "code.cloudfoundry.org/cli/integration/assets/hydrabroker/resources" "code.cloudfoundry.org/cli/integration/assets/hydrabroker/store" - uuid "github.com/nu7hatch/gouuid" + "github.com/google/uuid" ) var _ = Describe("Instances", func() { @@ -16,11 +16,7 @@ var _ = Describe("Instances", func() { ) randomID := func() store.InstanceID { - rawGUID, err := uuid.NewV4() - if err != nil { - panic(err) - } - + rawGUID := uuid.New() return store.InstanceID(rawGUID.String()) } diff --git a/integration/helpers/name_generator.go b/integration/helpers/name_generator.go index c6fcfeed525..ebeaefd976b 100644 --- a/integration/helpers/name_generator.go +++ b/integration/helpers/name_generator.go @@ -6,7 +6,7 @@ import ( "sort" "strings" - uuid "github.com/nu7hatch/gouuid" + "github.com/google/uuid" ) // TODO: Is this working??? @@ -162,12 +162,7 @@ func PrefixedRandomName(namePrefix string) string { // RandomName provides a random string func RandomName() string { - guid, err := uuid.NewV4() - if err != nil { - panic(err) - } - - return guid.String() + return uuid.New().String() } func RandomURL() string { diff --git a/integration/v7/push/canary_push_test.go b/integration/v7/push/canary_push_test.go index 58a9e5cf589..48391570f43 100644 --- a/integration/v7/push/canary_push_test.go +++ b/integration/v7/push/canary_push_test.go @@ -41,7 +41,6 @@ var _ = Describe("push with --strategy canary", func() { Expect(session).To(Say(`Pushing app %s to org %s / space %s as %s\.\.\.`, appName, organization, space, userName)) Expect(session).To(Say(`Packaging files to upload\.\.\.`)) Expect(session).To(Say(`Uploading files\.\.\.`)) - Expect(session).To(Say(`100.00%`)) Expect(session).To(Say(`Waiting for API to complete processing files\.\.\.`)) Expect(session).To(Say(`Staging app and tracing logs\.\.\.`)) Expect(session).To(Say(`Starting deployment for app %s\.\.\.`, appName)) @@ -72,7 +71,6 @@ var _ = Describe("push with --strategy canary", func() { Expect(session).To(Say(`Pushing app %s to org %s / space %s as %s\.\.\.`, appName, organization, space, userName)) Expect(session).To(Say(`Packaging files to upload\.\.\.`)) Expect(session).To(Say(`Uploading files\.\.\.`)) - Expect(session).To(Say(`100.00%`)) Expect(session).To(Say(`Waiting for API to complete processing files\.\.\.`)) Expect(session).To(Say(`Staging app and tracing logs\.\.\.`)) Expect(session).To(Say(`Starting deployment for app %s\.\.\.`, appName)) @@ -144,7 +142,6 @@ var _ = Describe("push with --strategy canary", func() { Expect(session).To(Say(`Pushing app %s to org %s / space %s as %s\.\.\.`, appName, organization, space, userName)) Expect(session).To(Say(`Packaging files to upload\.\.\.`)) Expect(session).To(Say(`Uploading files\.\.\.`)) - Expect(session).To(Say(`100.00%`)) Expect(session).To(Say(`Waiting for API to complete processing files\.\.\.`)) Expect(session).To(Say(`Staging app and tracing logs\.\.\.`)) Expect(session).To(Say(`Starting deployment for app %s\.\.\.`, appName)) diff --git a/integration/v7/push/rolling_push_test.go b/integration/v7/push/rolling_push_test.go index 98e26aeca78..2aa8b159aa4 100644 --- a/integration/v7/push/rolling_push_test.go +++ b/integration/v7/push/rolling_push_test.go @@ -40,7 +40,6 @@ var _ = Describe("push with --strategy rolling", func() { Expect(session).To(Say(`Pushing app %s to org %s / space %s as %s\.\.\.`, appName, organization, space, userName)) Expect(session).To(Say(`Packaging files to upload\.\.\.`)) Expect(session).To(Say(`Uploading files\.\.\.`)) - Expect(session).To(Say(`100.00%`)) Expect(session).To(Say(`Waiting for API to complete processing files\.\.\.`)) Expect(session).To(Say(`Staging app and tracing logs\.\.\.`)) Expect(session).To(Say(`Starting deployment for app %s\.\.\.`, appName)) @@ -64,7 +63,6 @@ var _ = Describe("push with --strategy rolling", func() { Expect(session).To(Say(`Pushing app %s to org %s / space %s as %s\.\.\.`, appName, organization, space, userName)) Expect(session).To(Say(`Packaging files to upload\.\.\.`)) Expect(session).To(Say(`Uploading files\.\.\.`)) - Expect(session).To(Say(`100.00%`)) Expect(session).To(Say(`Waiting for API to complete processing files\.\.\.`)) Expect(session).To(Say(`Staging app and tracing logs\.\.\.`)) Expect(session).To(Say(`Starting deployment for app %s\.\.\.`, appName)) @@ -130,7 +128,6 @@ var _ = Describe("push with --strategy rolling", func() { Expect(session).To(Say(`Pushing app %s to org %s / space %s as %s\.\.\.`, appName, organization, space, userName)) Expect(session).To(Say(`Packaging files to upload\.\.\.`)) Expect(session).To(Say(`Uploading files\.\.\.`)) - Expect(session).To(Say(`100.00%`)) Expect(session).To(Say(`Waiting for API to complete processing files\.\.\.`)) Expect(session).To(Say(`Staging app and tracing logs\.\.\.`)) Expect(session).To(Say(`Starting deployment for app %s\.\.\.`, appName)) diff --git a/util/download/downloadfakes/fake_progress_bar.go b/util/download/downloadfakes/fake_progress_bar.go index c23e09c6012..41fa8a8a79b 100644 --- a/util/download/downloadfakes/fake_progress_bar.go +++ b/util/download/downloadfakes/fake_progress_bar.go @@ -6,7 +6,7 @@ import ( "sync" "code.cloudfoundry.org/cli/util/download" - pb "gopkg.in/cheggaaa/pb.v1" + pb "github.com/cheggaaa/pb/v3" ) type FakeProgressBar struct { @@ -54,9 +54,10 @@ func (fake *FakeProgressBar) Finish() { fake.finishMutex.Lock() fake.finishArgsForCall = append(fake.finishArgsForCall, struct { }{}) + stub := fake.FinishStub fake.recordInvocation("Finish", []interface{}{}) fake.finishMutex.Unlock() - if fake.FinishStub != nil { + if stub != nil { fake.FinishStub() } } @@ -79,15 +80,16 @@ func (fake *FakeProgressBar) NewProxyReader(arg1 io.Reader) *pb.Reader { fake.newProxyReaderArgsForCall = append(fake.newProxyReaderArgsForCall, struct { arg1 io.Reader }{arg1}) + stub := fake.NewProxyReaderStub + fakeReturns := fake.newProxyReaderReturns fake.recordInvocation("NewProxyReader", []interface{}{arg1}) fake.newProxyReaderMutex.Unlock() - if fake.NewProxyReaderStub != nil { - return fake.NewProxyReaderStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1 } - fakeReturns := fake.newProxyReaderReturns return fakeReturns.result1 } @@ -139,15 +141,16 @@ func (fake *FakeProgressBar) SetTotal(arg1 int) *pb.ProgressBar { fake.setTotalArgsForCall = append(fake.setTotalArgsForCall, struct { arg1 int }{arg1}) + stub := fake.SetTotalStub + fakeReturns := fake.setTotalReturns fake.recordInvocation("SetTotal", []interface{}{arg1}) fake.setTotalMutex.Unlock() - if fake.SetTotalStub != nil { - return fake.SetTotalStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1 } - fakeReturns := fake.setTotalReturns return fakeReturns.result1 } @@ -198,15 +201,16 @@ func (fake *FakeProgressBar) Start() *pb.ProgressBar { ret, specificReturn := fake.startReturnsOnCall[len(fake.startArgsForCall)] fake.startArgsForCall = append(fake.startArgsForCall, struct { }{}) + stub := fake.StartStub + fakeReturns := fake.startReturns fake.recordInvocation("Start", []interface{}{}) fake.startMutex.Unlock() - if fake.StartStub != nil { - return fake.StartStub() + if stub != nil { + return stub() } if specificReturn { return ret.result1 } - fakeReturns := fake.startReturns return fakeReturns.result1 } diff --git a/util/download/progress_bar.go b/util/download/progress_bar.go index 6f84a157ed9..24db4da985f 100644 --- a/util/download/progress_bar.go +++ b/util/download/progress_bar.go @@ -3,7 +3,7 @@ package download import ( "io" - pb "gopkg.in/cheggaaa/pb.v1" + "github.com/cheggaaa/pb/v3" ) //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . ProgressBar diff --git a/util/progressbar/progress_bar.go b/util/progressbar/progress_bar.go index c97efeb48d8..a43d818ce41 100644 --- a/util/progressbar/progress_bar.go +++ b/util/progressbar/progress_bar.go @@ -4,8 +4,8 @@ import ( "io" "time" + "github.com/cheggaaa/pb/v3" log "github.com/sirupsen/logrus" - pb "gopkg.in/cheggaaa/pb.v1" ) type ProgressBar struct { @@ -34,8 +34,8 @@ func (p *ProgressBar) NewProgressBarWrapper(reader io.Reader, sizeOfFile int64) } log.Debug("progress bar ready") - p.bar = pb.New(int(sizeOfFile)).SetUnits(pb.U_BYTES) - p.bar.ShowTimeLeft = false + p.bar = pb.New(int(sizeOfFile)) + p.bar.Set(pb.Bytes, true) p.bar.Start() return p.bar.NewProxyReader(reader) }