(offeringName, brokerName, orgName, planName string)
| 143 | } |
| 144 | |
| 145 | func (actor *Actor) DisableServiceAccess(offeringName, brokerName, orgName, planName string) (SkippedPlans, Warnings, error) { |
| 146 | var allWarnings Warnings |
| 147 | |
| 148 | offering, offeringWarnings, err := actor.CloudControllerClient.GetServiceOfferingByNameAndBroker(offeringName, brokerName) |
| 149 | allWarnings = append(allWarnings, offeringWarnings...) |
| 150 | if err != nil { |
| 151 | return SkippedPlans{}, allWarnings, actionerror.EnrichAPIErrors(err) |
| 152 | } |
| 153 | |
| 154 | plansQuery := buildPlansFilterForUpdate(offering.GUID, planName) |
| 155 | plans, planWarnings, err := actor.CloudControllerClient.GetServicePlans(plansQuery...) |
| 156 | allWarnings = append(allWarnings, planWarnings...) |
| 157 | if err != nil { |
| 158 | return SkippedPlans{}, allWarnings, err |
| 159 | } |
| 160 | |
| 161 | if len(plans) == 0 { |
| 162 | return SkippedPlans{}, allWarnings, actionerror.ServicePlanNotFoundError{ |
| 163 | PlanName: planName, |
| 164 | OfferingName: offeringName, |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | if offeringIsSpaceScoped(plans) { |
| 169 | return SkippedPlans{}, allWarnings, actionerror.ServicePlanVisibilityTypeError{} |
| 170 | } |
| 171 | |
| 172 | var ( |
| 173 | disableWarnings Warnings |
| 174 | skipped SkippedPlans |
| 175 | ) |
| 176 | |
| 177 | if orgName != "" { |
| 178 | skipped, disableWarnings, err = actor.disableOrganizationServiceAccess(plans, orgName) |
| 179 | } else { |
| 180 | skipped, disableWarnings, err = actor.disableAllServiceAccess(plans) |
| 181 | } |
| 182 | |
| 183 | allWarnings = append(allWarnings, disableWarnings...) |
| 184 | return skipped, allWarnings, err |
| 185 | } |
| 186 | |
| 187 | func (actor *Actor) disableAllServiceAccess(plans []resources.ServicePlan) (SkippedPlans, Warnings, error) { |
| 188 | var ( |
nothing calls this directly
no test coverage detected