func FindBackupConfiguration(lister v1beta1_listers.BackupConfigurationLister, w *wapi.Workload) (*v1beta1_api.BackupConfiguration, error) {
	// list all BackupConfigurations from the lister
	backupConfigurations, err := lister.BackupConfigurations(w.Namespace).List(labels.Everything())
	if err != nil {
		return nil, err
	}
	result := make([]*v1beta1_api.BackupConfiguration, 0)
	// keep only those BackupConfiguration that has this workload as target
	for _, bc := range backupConfigurations {
		if bc.DeletionTimestamp == nil && IsBackupTarget(bc.Spec.Target, w) {
			result = append(result, bc)
		}
	}

	// if there is more than one BackupConfiguration then return error
	if len(result) > 1 {
		var msg bytes.Buffer
		msg.WriteString(fmt.Sprintf("Workload %s/%s matches multiple BackupConfigurations:", w.Namespace, w.Name))
		for i, bc := range result {
			if i > 0 {
				msg.WriteString(", ")
			}
			msg.WriteString(bc.Name)
		}
		return nil, errors.New(msg.String())
	} else if len(result) == 1 {
		// only one BackupConfiguration is found for this workload. So, return it.
		return result[0], nil
	}
	return nil, nil
}
// FindBackupConfiguration check if there is any BackupConfiguration exist for a particular workload.
// If multiple BackupConfigurations are found for the workload, it returns error.
FindBackupConfiguration check if there is any BackupConfiguration exist for a particular workload.
If multiple BackupConfigurations are found for the workload, it returns error.
// FindBackupConfiguration check if there is any BackupConfiguration exist for a particular workload . // If multiple BackupConfigurations are found for the workload it returns error .
func FindBackupConfiguration(lister v1beta1_listers.BackupConfigurationLister, w *wapi.Workload) (*v1beta1_api.BackupConfiguration, error) {
	backupConfigurations, err := lister.BackupConfigurations(w.Namespace).List(labels.Everything())
	if err != nil {
		return nil, err
	}
	result := make([]*v1beta1_api.BackupConfiguration, 0)
	for _, bc := range backupConfigurations {
		if bc.DeletionTimestamp == nil && IsBackupTarget(bc.Spec.Target, w) {
			result = append(result, bc)
		}
	}
	if len(result) > 1 {
		var msg bytes.Buffer
		msg.WriteString(fmt.Sprintf("Workload %s/%s matches multiple BackupConfigurations:", w.Namespace, w.Name))
		for i, bc := range result {
			if i > 0 {
				msg.WriteString(", ")
			}
			msg.WriteString(bc.Name)
		}
		return nil, errors.New(msg.String())
	} else if len(result) == 1 {
		return result[0], nil
	}
	return nil, nil
}
func FindBackupConfiguration ( lister v1beta1_listers . BackupConfigurationLister , w * wapi . Workload ) ( * v1beta1_api . BackupConfiguration , error ) { backupConfigurations , err := lister . BackupConfigurations ( w . Namespace ) . List ( labels . Everything ( ) ) if err != nil { return nil , err } result := make ( [ ] * v1beta1_api . BackupConfiguration , 0 ) for _ , bc := range backupConfigurations { if bc . DeletionTimestamp == nil && IsBackupTarget ( bc . Spec . Target , w ) { result = append ( result , bc ) } } if len ( result ) > 1 { var msg bytes . Buffer msg . WriteString ( fmt . Sprintf ( " " , w . Namespace , w . Name ) ) for i , bc := range result { if i > 0 { msg . WriteString ( " " ) } msg . WriteString ( bc . Name ) } return nil , errors . New ( msg . String ( ) ) } else if len ( result ) == 1 { return result [ 0 ] , nil } return nil , nil }
FindBackupConfiguration check if there is any BackupConfiguration exist for a particular workload.
FindBackupConfiguration check if there is any BackupConfiguration exist for a particular workload .
// list all BackupConfigurations from the lister // keep only those BackupConfiguration that has this workload as target // if there is more than one BackupConfiguration then return error // only one BackupConfiguration is found for this workload. So, return it.