(spaceName string, orgGUID string, enabled bool, feature string)
| 3 | import "code.cloudfoundry.org/cli/v8/actor/actionerror" |
| 4 | |
| 5 | func (actor Actor) UpdateSpaceFeature(spaceName string, orgGUID string, enabled bool, feature string) (Warnings, error) { |
| 6 | var allWarnings Warnings |
| 7 | |
| 8 | space, warnings, err := actor.GetSpaceByNameAndOrganization(spaceName, orgGUID) |
| 9 | allWarnings = append(allWarnings, warnings...) |
| 10 | if err != nil { |
| 11 | return allWarnings, err |
| 12 | } |
| 13 | |
| 14 | previousValue, ccv3Warnings, err := actor.CloudControllerClient.GetSpaceFeature(space.GUID, feature) |
| 15 | |
| 16 | allWarnings = append(allWarnings, ccv3Warnings...) |
| 17 | |
| 18 | if err != nil { |
| 19 | return allWarnings, err |
| 20 | } |
| 21 | |
| 22 | if (previousValue == enabled) && (feature == "ssh") { |
| 23 | if enabled { |
| 24 | return allWarnings, actionerror.SpaceSSHAlreadyEnabledError{Space: space.Name} |
| 25 | } else { |
| 26 | return allWarnings, actionerror.SpaceSSHAlreadyDisabledError{Space: space.Name} |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | ccv3Warnings, err = actor.CloudControllerClient.UpdateSpaceFeature(space.GUID, enabled, feature) |
| 31 | allWarnings = append(allWarnings, Warnings(ccv3Warnings)...) |
| 32 | |
| 33 | return allWarnings, err |
| 34 | } |
| 35 | |
| 36 | func (actor Actor) GetSpaceFeature(spaceName string, orgGUID string, feature string) (bool, Warnings, error) { |
| 37 | var allWarnings Warnings |
nothing calls this directly
no test coverage detected