github.com/LukasHeimann/cloudfoundrycli/v8@v8.4.4/command/translatableerror/service_plan_not_found_error.go (about)

     1  package translatableerror
     2  
     3  type ServicePlanNotFoundError struct {
     4  	PlanName          string
     5  	OfferingName      string
     6  	ServiceBrokerName string
     7  }
     8  
     9  func (e ServicePlanNotFoundError) Error() string {
    10  	if e.OfferingName == "" {
    11  		return "Service plan '{{.PlanName}}' not found."
    12  	}
    13  	if e.OfferingName != "" && e.PlanName != "" && e.ServiceBrokerName != "" {
    14  		return "The plan '{{.PlanName}}' could not be found for service offering '{{.OfferingName}}' and broker '{{.ServiceBrokerName}}'."
    15  	}
    16  
    17  	return "The plan '{{.PlanName}}' could not be found for service offering '{{.OfferingName}}'."
    18  }
    19  
    20  func (e ServicePlanNotFoundError) Translate(translate func(string, ...interface{}) string) string {
    21  	return translate(e.Error(), map[string]interface{}{
    22  		"PlanName":          e.PlanName,
    23  		"OfferingName":      e.OfferingName,
    24  		"ServiceBrokerName": e.ServiceBrokerName,
    25  	})
    26  }