github.com/cloudfoundry-community/cloudfoundry-cli@v6.44.1-0.20240130060226-cda5ed8e89a5+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  	"code.cloudfoundry.org/cli/api/cloudcontroller/ccv3"
     7  	"strconv"
     8  )
     9  
    10  func (actor Actor) SetSpaceManifest(spaceGUID string, rawManifest []byte, noRoute bool) (Warnings, error) {
    11  	var allWarnings Warnings
    12  	jobURL, applyManifestWarnings, err := actor.CloudControllerClient.UpdateSpaceApplyManifest(
    13  		spaceGUID,
    14  		rawManifest,
    15  		ccv3.Query{
    16  			Key:    ccv3.NoRouteFilter,
    17  			Values: []string{strconv.FormatBool(noRoute)},
    18  		},
    19  	)
    20  	allWarnings = append(allWarnings, applyManifestWarnings...)
    21  	if err != nil {
    22  		return allWarnings, err
    23  	}
    24  
    25  	pollWarnings, err := actor.CloudControllerClient.PollJob(jobURL)
    26  	allWarnings = append(allWarnings, pollWarnings...)
    27  	if err != nil {
    28  		if newErr, ok := err.(ccerror.V3JobFailedError); ok {
    29  			return allWarnings, actionerror.ApplicationManifestError{Message: newErr.Detail}
    30  		}
    31  		return allWarnings, err
    32  	}
    33  	return allWarnings, nil
    34  }