// Validate validates the LinkOptions based on completed values
Validate validates the LinkOptions based on completed values
// Validate validates the LinkOptions based on completed values
func (o *LinkOptions) Validate() (err error) {
	err = o.validate(o.waitForTarget)
	if err != nil {
		return err
	}
	if o.Context.EnvSpecificInfo != nil {
		return
	}
	alreadyLinkedSecretNames, err := component.GetComponentLinkedSecretNames(o.Client, o.Component(), o.Application)
	if err != nil {
		return err
	}
	for _, alreadyLinkedSecretName := range alreadyLinkedSecretNames {
		if alreadyLinkedSecretName == o.secretName {
			targetType := "component"
			if o.isTargetAService {
				targetType = "service"
			}
			return fmt.Errorf("Component %s has previously been linked to %s %s", o.Project, targetType, o.suppliedName)
		}
	}
	return
}
func ( o * LinkOptions ) Validate ( ) ( err error ) { err = o . validate ( o . waitForTarget ) if err != nil { return err } if o . Context . EnvSpecificInfo != nil { return } alreadyLinkedSecretNames , err := component . GetComponentLinkedSecretNames ( o . Client , o . Component ( ) , o . Application ) if err != nil { return err } for _ , alreadyLinkedSecretName := range alreadyLinkedSecretNames { if alreadyLinkedSecretName == o . secretName { targetType := " " if o . isTargetAService { targetType = " " } return fmt . Errorf ( " " , o . Project , targetType , o . suppliedName ) } } return }
Validate validates the LinkOptions based on completed values
Validate validates the LinkOptions based on completed values