Skip to content

Commit

Permalink
Remove direct requirement of github.com/tedsuo/rata
Browse files Browse the repository at this point in the history
Signed-off-by: João Pereira <[email protected]>
  • Loading branch information
joaopapereira committed Nov 20, 2024
1 parent 6b87db8 commit 7be4b2a
Show file tree
Hide file tree
Showing 51 changed files with 278 additions and 235 deletions.
17 changes: 9 additions & 8 deletions api/cloudcontroller/ccv3/application.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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,
})
Expand Down Expand Up @@ -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 {
Expand All @@ -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,
Expand All @@ -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,
Expand All @@ -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,
})
Expand All @@ -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,
})
Expand All @@ -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,
})
Expand Down
9 changes: 5 additions & 4 deletions api/cloudcontroller/ccv3/application_feature.go
Original file line number Diff line number Diff line change
@@ -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"
)

Expand All @@ -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,
})
Expand All @@ -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,
})
Expand All @@ -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},
Expand Down
7 changes: 4 additions & 3 deletions api/cloudcontroller/ccv3/build.go
Original file line number Diff line number Diff line change
@@ -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"
)

Expand All @@ -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,
})
Expand All @@ -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,
})
Expand Down
13 changes: 7 additions & 6 deletions api/cloudcontroller/ccv3/buildpack.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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,
})
Expand All @@ -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},
})

Expand All @@ -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 {
Expand All @@ -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,
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion api/cloudcontroller/ccv3/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 7 additions & 6 deletions api/cloudcontroller/ccv3/deployment.go
Original file line number Diff line number Diff line change
@@ -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},
})

Expand All @@ -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},
})

Expand All @@ -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,
})
Expand All @@ -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,
})
Expand All @@ -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 {
Expand Down
19 changes: 10 additions & 9 deletions api/cloudcontroller/ccv3/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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,
Expand All @@ -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,
})
Expand All @@ -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},
})

Expand All @@ -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,
})
Expand All @@ -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 {
Expand All @@ -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 {
Expand All @@ -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,
})
Expand All @@ -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},
})

Expand Down
Loading

0 comments on commit 7be4b2a

Please sign in to comment.