forked from cloudfoundry/cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
space.go
33 lines (28 loc) · 1.1 KB
/
space.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package v3action
// ResetSpaceIsolationSegment disassociates a space from an isolation segment.
//
// If the space's organization has a default isolation segment, return its
// name. Otherwise return the empty string.
func (actor Actor) ResetSpaceIsolationSegment(orgGUID string, spaceGUID string) (string, Warnings, error) {
var allWarnings Warnings
_, apiWarnings, err := actor.CloudControllerClient.AssignSpaceToIsolationSegment(spaceGUID, "")
allWarnings = append(allWarnings, apiWarnings...)
if err != nil {
return "", allWarnings, err
}
isoSegRelationship, apiWarnings, err := actor.CloudControllerClient.GetOrganizationDefaultIsolationSegment(orgGUID)
allWarnings = append(allWarnings, apiWarnings...)
if err != nil {
return "", allWarnings, err
}
var isoSegName string
if isoSegRelationship.GUID != "" {
isolationSegment, apiWarnings, err := actor.CloudControllerClient.GetIsolationSegment(isoSegRelationship.GUID)
allWarnings = append(allWarnings, apiWarnings...)
if err != nil {
return "", allWarnings, err
}
isoSegName = isolationSegment.Name
}
return isoSegName, allWarnings, nil
}