github.com/wanddynosios/cli/v8@v8.7.9-0.20240221182337-1a92e3a7017f/actor/v7action/cloud_controller_client.go (about)

     1  package v7action
     2  
     3  import (
     4  	"io"
     5  	"net/http"
     6  
     7  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3"
     8  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3/constant"
     9  	"code.cloudfoundry.org/cli/resources"
    10  	"code.cloudfoundry.org/cli/types"
    11  )
    12  
    13  //go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 . CloudControllerClient
    14  
    15  // CloudControllerClient is the interface to the cloud controller V3 API.
    16  type CloudControllerClient interface {
    17  	ApplyOrganizationQuota(quotaGUID string, orgGUID string) (resources.RelationshipList, ccv3.Warnings, error)
    18  	ApplySpaceQuota(quotaGUID string, spaceGUID string) (resources.RelationshipList, ccv3.Warnings, error)
    19  	CheckRoute(domainGUID string, hostname string, path string, port int) (bool, ccv3.Warnings, error)
    20  	CancelDeployment(deploymentGUID string) (ccv3.Warnings, error)
    21  	CopyPackage(sourcePackageGUID string, targetAppGUID string) (resources.Package, ccv3.Warnings, error)
    22  	CreateApplication(app resources.Application) (resources.Application, ccv3.Warnings, error)
    23  	CreateApplicationDeployment(appGUID string, dropletGUID string) (string, ccv3.Warnings, error)
    24  	CreateApplicationDeploymentByRevision(appGUID string, revisionGUID string) (string, ccv3.Warnings, error)
    25  	CreateApplicationProcessScale(appGUID string, process resources.Process) (resources.Process, ccv3.Warnings, error)
    26  	CreateApplicationTask(appGUID string, task resources.Task) (resources.Task, ccv3.Warnings, error)
    27  	CreateBuild(build resources.Build) (resources.Build, ccv3.Warnings, error)
    28  	CreateBuildpack(bp resources.Buildpack) (resources.Buildpack, ccv3.Warnings, error)
    29  	CreateDomain(domain resources.Domain) (resources.Domain, ccv3.Warnings, error)
    30  	CreateDroplet(appGUID string) (resources.Droplet, ccv3.Warnings, error)
    31  	CreateIsolationSegment(isolationSegment resources.IsolationSegment) (resources.IsolationSegment, ccv3.Warnings, error)
    32  	CreateOrganization(orgName string) (resources.Organization, ccv3.Warnings, error)
    33  	CreateOrganizationQuota(orgQuota resources.OrganizationQuota) (resources.OrganizationQuota, ccv3.Warnings, error)
    34  	CreatePackage(pkg resources.Package) (resources.Package, ccv3.Warnings, error)
    35  	CreateRole(role resources.Role) (resources.Role, ccv3.Warnings, error)
    36  	CreateRoute(route resources.Route) (resources.Route, ccv3.Warnings, error)
    37  	CreateRouteBinding(binding resources.RouteBinding) (ccv3.JobURL, ccv3.Warnings, error)
    38  	CreateServiceBroker(serviceBroker resources.ServiceBroker) (ccv3.JobURL, ccv3.Warnings, error)
    39  	CreateServiceCredentialBinding(binding resources.ServiceCredentialBinding) (ccv3.JobURL, ccv3.Warnings, error)
    40  	CreateServiceInstance(serviceInstance resources.ServiceInstance) (ccv3.JobURL, ccv3.Warnings, error)
    41  	CreateSecurityGroup(securityGroup resources.SecurityGroup) (resources.SecurityGroup, ccv3.Warnings, error)
    42  	CreateSpace(space resources.Space) (resources.Space, ccv3.Warnings, error)
    43  	CreateSpaceQuota(spaceQuota resources.SpaceQuota) (resources.SpaceQuota, ccv3.Warnings, error)
    44  	CreateUser(userGUID string) (resources.User, ccv3.Warnings, error)
    45  	DeleteApplication(guid string) (ccv3.JobURL, ccv3.Warnings, error)
    46  	DeleteApplicationProcessInstance(appGUID string, processType string, instanceIndex int) (ccv3.Warnings, error)
    47  	DeleteBuildpack(buildpackGUID string) (ccv3.JobURL, ccv3.Warnings, error)
    48  	DeleteDomain(domainGUID string) (ccv3.JobURL, ccv3.Warnings, error)
    49  	DeleteIsolationSegment(guid string) (ccv3.Warnings, error)
    50  	DeleteIsolationSegmentOrganization(isolationSegmentGUID string, organizationGUID string) (ccv3.Warnings, error)
    51  	DeleteOrganization(orgGUID string) (ccv3.JobURL, ccv3.Warnings, error)
    52  	DeleteOrganizationQuota(quotaGUID string) (ccv3.JobURL, ccv3.Warnings, error)
    53  	DeleteOrphanedRoutes(spaceGUID string) (ccv3.JobURL, ccv3.Warnings, error)
    54  	DeleteRole(roleGUID string) (ccv3.JobURL, ccv3.Warnings, error)
    55  	DeleteRoute(routeGUID string) (ccv3.JobURL, ccv3.Warnings, error)
    56  	DeleteRouteBinding(guid string) (ccv3.JobURL, ccv3.Warnings, error)
    57  	DeleteSecurityGroup(securityGroupGUID string) (ccv3.JobURL, ccv3.Warnings, error)
    58  	DeleteServiceCredentialBinding(guid string) (ccv3.JobURL, ccv3.Warnings, error)
    59  	DeleteServiceBroker(serviceBrokerGUID string) (ccv3.JobURL, ccv3.Warnings, error)
    60  	DeleteServiceInstance(serviceInstanceGUID string, query ...ccv3.Query) (ccv3.JobURL, ccv3.Warnings, error)
    61  	DeleteSpaceQuota(spaceQuotaGUID string) (ccv3.JobURL, ccv3.Warnings, error)
    62  	DeleteSpace(guid string) (ccv3.JobURL, ccv3.Warnings, error)
    63  	DeleteUser(userGUID string) (ccv3.JobURL, ccv3.Warnings, error)
    64  	DownloadDroplet(dropletGUID string) ([]byte, ccv3.Warnings, error)
    65  	EntitleIsolationSegmentToOrganizations(isoGUID string, orgGUIDs []string) (resources.RelationshipList, ccv3.Warnings, error)
    66  	GetApplicationByNameAndSpace(appName string, spaceGUID string) (resources.Application, ccv3.Warnings, error)
    67  	GetApplicationDropletCurrent(appGUID string) (resources.Droplet, ccv3.Warnings, error)
    68  	GetApplicationEnvironment(appGUID string) (ccv3.Environment, ccv3.Warnings, error)
    69  	GetApplicationManifest(appGUID string) ([]byte, ccv3.Warnings, error)
    70  	GetApplicationProcessByType(appGUID string, processType string) (resources.Process, ccv3.Warnings, error)
    71  	GetApplicationProcesses(appGUID string) ([]resources.Process, ccv3.Warnings, error)
    72  	GetApplicationRevisions(appGUID string, query ...ccv3.Query) ([]resources.Revision, ccv3.Warnings, error)
    73  	GetApplicationRevisionsDeployed(appGUID string) ([]resources.Revision, ccv3.Warnings, error)
    74  	GetApplicationRoutes(appGUID string) ([]resources.Route, ccv3.Warnings, error)
    75  	GetApplicationTasks(appGUID string, query ...ccv3.Query) ([]resources.Task, ccv3.Warnings, error)
    76  	GetApplications(query ...ccv3.Query) ([]resources.Application, ccv3.Warnings, error)
    77  	GetBuild(guid string) (resources.Build, ccv3.Warnings, error)
    78  	GetBuildpacks(query ...ccv3.Query) ([]resources.Buildpack, ccv3.Warnings, error)
    79  	GetDefaultDomain(orgGuid string) (resources.Domain, ccv3.Warnings, error)
    80  	GetDeployment(guid string) (resources.Deployment, ccv3.Warnings, error)
    81  	GetDeployments(query ...ccv3.Query) ([]resources.Deployment, ccv3.Warnings, error)
    82  	GetDomain(GUID string) (resources.Domain, ccv3.Warnings, error)
    83  	GetDomains(query ...ccv3.Query) ([]resources.Domain, ccv3.Warnings, error)
    84  	GetDroplet(guid string) (resources.Droplet, ccv3.Warnings, error)
    85  	GetDroplets(query ...ccv3.Query) ([]resources.Droplet, ccv3.Warnings, error)
    86  	GetEnvironmentVariableGroup(group constant.EnvironmentVariableGroupName) (resources.EnvironmentVariables, ccv3.Warnings, error)
    87  	GetEvents(query ...ccv3.Query) ([]ccv3.Event, ccv3.Warnings, error)
    88  	GetFeatureFlag(featureFlagName string) (resources.FeatureFlag, ccv3.Warnings, error)
    89  	GetFeatureFlags() ([]resources.FeatureFlag, ccv3.Warnings, error)
    90  	GetInfo() (ccv3.Info, ccv3.Warnings, error)
    91  	GetIsolationSegment(guid string) (resources.IsolationSegment, ccv3.Warnings, error)
    92  	GetIsolationSegmentOrganizations(isolationSegmentGUID string) ([]resources.Organization, ccv3.Warnings, error)
    93  	GetIsolationSegments(query ...ccv3.Query) ([]resources.IsolationSegment, ccv3.Warnings, error)
    94  	GetNewApplicationProcesses(appGUID string, deploymentGUID string) ([]resources.Process, ccv3.Warnings, error)
    95  	GetOrganization(orgGUID string) (resources.Organization, ccv3.Warnings, error)
    96  	GetOrganizationDefaultIsolationSegment(orgGUID string) (resources.Relationship, ccv3.Warnings, error)
    97  	GetOrganizationDomains(orgGUID string, query ...ccv3.Query) ([]resources.Domain, ccv3.Warnings, error)
    98  	GetOrganizationQuota(quotaGUID string) (resources.OrganizationQuota, ccv3.Warnings, error)
    99  	GetOrganizationQuotas(query ...ccv3.Query) ([]resources.OrganizationQuota, ccv3.Warnings, error)
   100  	GetOrganizations(query ...ccv3.Query) ([]resources.Organization, ccv3.Warnings, error)
   101  	GetPackage(guid string) (resources.Package, ccv3.Warnings, error)
   102  	GetPackages(query ...ccv3.Query) ([]resources.Package, ccv3.Warnings, error)
   103  	GetPackageDroplets(packageGUID string, query ...ccv3.Query) ([]resources.Droplet, ccv3.Warnings, error)
   104  	GetProcess(processGUID string) (resources.Process, ccv3.Warnings, error)
   105  	GetProcesses(query ...ccv3.Query) ([]resources.Process, ccv3.Warnings, error)
   106  	GetProcessInstances(processGUID string) ([]ccv3.ProcessInstance, ccv3.Warnings, error)
   107  	GetProcessSidecars(processGUID string) ([]resources.Sidecar, ccv3.Warnings, error)
   108  	GetRoles(query ...ccv3.Query) ([]resources.Role, ccv3.IncludedResources, ccv3.Warnings, error)
   109  	GetRouteBindings(query ...ccv3.Query) ([]resources.RouteBinding, ccv3.IncludedResources, ccv3.Warnings, error)
   110  	GetRouteDestinations(routeGUID string) ([]resources.RouteDestination, ccv3.Warnings, error)
   111  	GetRoutes(query ...ccv3.Query) ([]resources.Route, ccv3.Warnings, error)
   112  	GetRunningSecurityGroups(spaceGUID string, queries ...ccv3.Query) ([]resources.SecurityGroup, ccv3.Warnings, error)
   113  	GetSecurityGroups(query ...ccv3.Query) ([]resources.SecurityGroup, ccv3.Warnings, error)
   114  	GetServiceBrokers(query ...ccv3.Query) ([]resources.ServiceBroker, ccv3.Warnings, error)
   115  	GetServiceCredentialBindings(query ...ccv3.Query) ([]resources.ServiceCredentialBinding, ccv3.Warnings, error)
   116  	GetServiceCredentialBindingDetails(guid string) (resources.ServiceCredentialBindingDetails, ccv3.Warnings, error)
   117  	GetServiceInstanceByNameAndSpace(name, spaceGUID string, query ...ccv3.Query) (resources.ServiceInstance, ccv3.IncludedResources, ccv3.Warnings, error)
   118  	GetServiceInstanceParameters(serviceInstanceGUID string) (types.JSONObject, ccv3.Warnings, error)
   119  	GetServiceInstanceSharedSpaces(serviceInstanceGUID string) ([]ccv3.SpaceWithOrganization, ccv3.Warnings, error)
   120  	GetServiceInstanceUsageSummary(serviceInstanceGUID string) ([]resources.ServiceInstanceUsageSummary, ccv3.Warnings, error)
   121  	GetServiceInstances(query ...ccv3.Query) ([]resources.ServiceInstance, ccv3.IncludedResources, ccv3.Warnings, error)
   122  	GetServiceOfferingByGUID(guid string) (resources.ServiceOffering, ccv3.Warnings, error)
   123  	GetServiceOfferings(query ...ccv3.Query) ([]resources.ServiceOffering, ccv3.Warnings, error)
   124  	GetServiceOfferingByNameAndBroker(serviceOfferingName, serviceBrokerName string) (resources.ServiceOffering, ccv3.Warnings, error)
   125  	GetServicePlanByGUID(guid string) (resources.ServicePlan, ccv3.Warnings, error)
   126  	GetServicePlans(query ...ccv3.Query) ([]resources.ServicePlan, ccv3.Warnings, error)
   127  	GetServicePlansWithOfferings(query ...ccv3.Query) ([]ccv3.ServiceOfferingWithPlans, ccv3.Warnings, error)
   128  	GetServicePlansWithSpaceAndOrganization(query ...ccv3.Query) ([]ccv3.ServicePlanWithSpaceAndOrganization, ccv3.Warnings, error)
   129  	GetSpaceFeature(spaceGUID string, featureName string) (bool, ccv3.Warnings, error)
   130  	GetSpaceIsolationSegment(spaceGUID string) (resources.Relationship, ccv3.Warnings, error)
   131  	GetSpaceManifestDiff(spaceGUID string, rawManifest []byte) (resources.ManifestDiff, ccv3.Warnings, error)
   132  	GetSpaceQuota(spaceQuotaGUID string) (resources.SpaceQuota, ccv3.Warnings, error)
   133  	GetSpaces(query ...ccv3.Query) ([]resources.Space, ccv3.IncludedResources, ccv3.Warnings, error)
   134  	GetSpaceQuotas(query ...ccv3.Query) ([]resources.SpaceQuota, ccv3.Warnings, error)
   135  	GetSSHEnabled(appGUID string) (ccv3.SSHEnabled, ccv3.Warnings, error)
   136  	GetAppFeature(appGUID string, featureName string) (resources.ApplicationFeature, ccv3.Warnings, error)
   137  	GetStacks(query ...ccv3.Query) ([]resources.Stack, ccv3.Warnings, error)
   138  	GetStagingSecurityGroups(spaceGUID string, queries ...ccv3.Query) ([]resources.SecurityGroup, ccv3.Warnings, error)
   139  	GetTask(guid string) (resources.Task, ccv3.Warnings, error)
   140  	GetUser(userGUID string) (resources.User, ccv3.Warnings, error)
   141  	GetUsers(query ...ccv3.Query) ([]resources.User, ccv3.Warnings, error)
   142  	MakeRequestSendReceiveRaw(Method string, URL string, headers http.Header, requestBody []byte) ([]byte, *http.Response, error)
   143  	MapRoute(routeGUID string, appGUID string, destinationProtocol string) (ccv3.Warnings, error)
   144  	MoveRoute(routeGUID string, spaceGUID string) (ccv3.Warnings, error)
   145  	PollJob(jobURL ccv3.JobURL) (ccv3.Warnings, error)
   146  	PollJobForState(jobURL ccv3.JobURL, state constant.JobState) (ccv3.Warnings, error)
   147  	PollJobToEventStream(jobURL ccv3.JobURL) chan ccv3.PollJobEvent
   148  	PurgeServiceOffering(serviceOfferingGUID string) (ccv3.Warnings, error)
   149  	ResourceMatch(resources []ccv3.Resource) ([]ccv3.Resource, ccv3.Warnings, error)
   150  	RootResponse() (ccv3.Info, ccv3.Warnings, error)
   151  	SetApplicationDroplet(appGUID string, dropletGUID string) (resources.Relationship, ccv3.Warnings, error)
   152  	SharePrivateDomainToOrgs(domainGuid string, sharedOrgs ccv3.SharedOrgs) (ccv3.Warnings, error)
   153  	ShareServiceInstanceToSpaces(serviceInstanceGUID string, spaceGUIDs []string) (resources.RelationshipList, ccv3.Warnings, error)
   154  	ShareRoute(routeGUID string, spaceGUID string) (ccv3.Warnings, error)
   155  	TargetCF(settings ccv3.TargetSettings)
   156  	UnbindSecurityGroupRunningSpace(securityGroupGUID string, spaceGUID string) (ccv3.Warnings, error)
   157  	UnbindSecurityGroupStagingSpace(securityGroupGUID string, spaceGUID string) (ccv3.Warnings, error)
   158  	UnmapRoute(routeGUID string, destinationGUID string) (ccv3.Warnings, error)
   159  	UnshareRoute(routeGUID string, spaceGUID string) (ccv3.Warnings, error)
   160  	UnsharePrivateDomainFromOrg(domainGUID string, sharedOrgGUID string) (ccv3.Warnings, error)
   161  	UnshareServiceInstanceFromSpace(serviceInstanceGUID string, sharedToSpaceGUID string) (ccv3.Warnings, error)
   162  	UpdateAppFeature(appGUID string, enabled bool, featureName string) (ccv3.Warnings, error)
   163  	UpdateApplication(app resources.Application) (resources.Application, ccv3.Warnings, error)
   164  	UpdateApplicationName(newAppName string, appGUID string) (resources.Application, ccv3.Warnings, error)
   165  	UpdateApplicationApplyManifest(appGUID string, rawManifest []byte) (ccv3.JobURL, ccv3.Warnings, error)
   166  	UpdateApplicationEnvironmentVariables(appGUID string, envVars resources.EnvironmentVariables) (resources.EnvironmentVariables, ccv3.Warnings, error)
   167  	UpdateApplicationRestart(appGUID string) (resources.Application, ccv3.Warnings, error)
   168  	UpdateApplicationStart(appGUID string) (resources.Application, ccv3.Warnings, error)
   169  	UpdateApplicationStop(appGUID string) (resources.Application, ccv3.Warnings, error)
   170  	UpdateDestination(routeGUID string, destinationGUID string, protocol string) (ccv3.Warnings, error)
   171  	UpdateBuildpack(buildpack resources.Buildpack) (resources.Buildpack, ccv3.Warnings, error)
   172  	UpdateEnvironmentVariableGroup(group constant.EnvironmentVariableGroupName, envVars resources.EnvironmentVariables) (resources.EnvironmentVariables, ccv3.Warnings, error)
   173  	UpdateFeatureFlag(flag resources.FeatureFlag) (resources.FeatureFlag, ccv3.Warnings, error)
   174  	UpdateOrganization(org resources.Organization) (resources.Organization, ccv3.Warnings, error)
   175  	UpdateOrganizationDefaultIsolationSegmentRelationship(orgGUID string, isolationSegmentGUID string) (resources.Relationship, ccv3.Warnings, error)
   176  	UpdateOrganizationQuota(orgQuota resources.OrganizationQuota) (resources.OrganizationQuota, ccv3.Warnings, error)
   177  	UpdateProcess(process resources.Process) (resources.Process, ccv3.Warnings, error)
   178  	UpdateResourceMetadata(resource string, resourceGUID string, metadata resources.Metadata) (ccv3.JobURL, ccv3.Warnings, error)
   179  	UpdateSecurityGroupRunningSpace(securityGroupGUID string, spaceGUIDs []string) (ccv3.Warnings, error)
   180  	UpdateSecurityGroupStagingSpace(securityGroupGUID string, spaceGUIDs []string) (ccv3.Warnings, error)
   181  	UpdateSecurityGroup(securityGroup resources.SecurityGroup) (resources.SecurityGroup, ccv3.Warnings, error)
   182  	UpdateServiceInstance(serviceInstanceGUID string, serviceInstanceUpdates resources.ServiceInstance) (ccv3.JobURL, ccv3.Warnings, error)
   183  	UpdateSpace(space resources.Space) (resources.Space, ccv3.Warnings, error)
   184  	UpdateSpaceApplyManifest(spaceGUID string, rawManifest []byte) (ccv3.JobURL, ccv3.Warnings, error)
   185  	UpdateSpaceFeature(spaceGUID string, enabled bool, featureName string) (ccv3.Warnings, error)
   186  	UpdateSpaceIsolationSegmentRelationship(spaceGUID string, isolationSegmentGUID string) (resources.Relationship, ccv3.Warnings, error)
   187  	UpdateSpaceQuota(spaceQuota resources.SpaceQuota) (resources.SpaceQuota, ccv3.Warnings, error)
   188  	UnsetSpaceQuota(spaceQuotaGUID, spaceGUID string) (ccv3.Warnings, error)
   189  	UpdateServiceBroker(serviceBrokerGUID string, serviceBroker resources.ServiceBroker) (ccv3.JobURL, ccv3.Warnings, error)
   190  	UpdateTaskCancel(taskGUID string) (resources.Task, ccv3.Warnings, error)
   191  	UploadBitsPackage(pkg resources.Package, matchedResources []ccv3.Resource, newResources io.Reader, newResourcesLength int64) (resources.Package, ccv3.Warnings, error)
   192  	UploadBuildpack(buildpackGUID string, buildpackPath string, buildpack io.Reader, buildpackLength int64) (ccv3.JobURL, ccv3.Warnings, error)
   193  	UploadDropletBits(dropletGUID string, dropletPath string, droplet io.Reader, dropletLength int64) (ccv3.JobURL, ccv3.Warnings, error)
   194  	UploadPackage(pkg resources.Package, zipFilepath string) (resources.Package, ccv3.Warnings, error)
   195  	WhoAmI() (resources.K8sUser, ccv3.Warnings, error)
   196  
   197  	servicePlanVisibilityClient
   198  }
   199  
   200  type servicePlanVisibilityClient interface {
   201  	GetServicePlanVisibility(servicePlanGUID string) (resources.ServicePlanVisibility, ccv3.Warnings, error)
   202  	UpdateServicePlanVisibility(servicePlanGUID string, visibility resources.ServicePlanVisibility) (resources.ServicePlanVisibility, ccv3.Warnings, error)
   203  	DeleteServicePlanVisibility(servicePlanGUID, organizationGUID string) (ccv3.Warnings, error)
   204  }
   205  
   206  // TODO: Split this enormous interface