github.com/cloudfoundry-attic/cli-with-i18n@v6.32.1-0.20171002233121-7401370d3b85+incompatible/actor/v3action/space.go (about)

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