github.com/loggregator/cli@v6.33.1-0.20180224010324-82334f081791+incompatible/cf/requirements/routing_api.go (about)

     1  package requirements
     2  
     3  import (
     4  	"errors"
     5  
     6  	"code.cloudfoundry.org/cli/cf/configuration/coreconfig"
     7  	. "code.cloudfoundry.org/cli/cf/i18n"
     8  )
     9  
    10  type RoutingAPIRequirement struct {
    11  	config coreconfig.Reader
    12  }
    13  
    14  func NewRoutingAPIRequirement(config coreconfig.Reader) RoutingAPIRequirement {
    15  	return RoutingAPIRequirement{
    16  		config,
    17  	}
    18  }
    19  
    20  func (req RoutingAPIRequirement) Execute() error {
    21  	if len(req.config.RoutingAPIEndpoint()) == 0 {
    22  		return errors.New(T("This command requires the Routing API. Your targeted endpoint reports it is not enabled."))
    23  	}
    24  
    25  	return nil
    26  }