github.com/Thanhphan1147/cloudfoundry-cli@v7.1.0+incompatible/actor/v7action/space_manifest.go (about)

     1  package v7action
     2  
     3  import (
     4  	"code.cloudfoundry.org/cli/actor/actionerror"
     5  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccerror"
     6  )
     7  
     8  func (actor Actor) SetSpaceManifest(spaceGUID string, rawManifest []byte) (Warnings, error) {
     9  	var allWarnings Warnings
    10  	jobURL, applyManifestWarnings, err := actor.CloudControllerClient.UpdateSpaceApplyManifest(
    11  		spaceGUID,
    12  		rawManifest,
    13  	)
    14  	allWarnings = append(allWarnings, applyManifestWarnings...)
    15  	if err != nil {
    16  		return allWarnings, err
    17  	}
    18  
    19  	pollWarnings, err := actor.CloudControllerClient.PollJob(jobURL)
    20  	allWarnings = append(allWarnings, pollWarnings...)
    21  	if err != nil {
    22  		if newErr, ok := err.(ccerror.V3JobFailedError); ok {
    23  			return allWarnings, actionerror.ApplicationManifestError{Message: newErr.Detail}
    24  		}
    25  		return allWarnings, err
    26  	}
    27  	return allWarnings, nil
    28  }