code.cloudfoundry.org/cli@v7.1.0+incompatible/actor/pushaction/service_binding.go (about)

     1  package pushaction
     2  
     3  func (actor Actor) BindServices(config ApplicationConfig) (ApplicationConfig, bool, Warnings, error) {
     4  	var allWarnings Warnings
     5  	var boundService bool
     6  	appGUID := config.DesiredApplication.GUID
     7  	for serviceInstanceName, serviceInstance := range config.DesiredServices {
     8  		if _, ok := config.CurrentServices[serviceInstanceName]; !ok {
     9  			warnings, err := actor.V2Actor.BindServiceByApplicationAndServiceInstance(appGUID, serviceInstance.GUID)
    10  			allWarnings = append(allWarnings, warnings...)
    11  			if err != nil {
    12  				return config, false, allWarnings, err
    13  			}
    14  			boundService = true
    15  		}
    16  	}
    17  
    18  	config.CurrentServices = config.DesiredServices
    19  	return config, boundService, allWarnings, nil
    20  }