// LookupProcessorIdentifier is not a direct API call, although it fires requests to get the result.
// It's a helper which can be used as an input argument of the `DeleteProcessor` and `StopProcessor` and `ResumeProcessor` and `UpdateProcessorRunners` functions.
//
// Fill the id or name in any case.
// Fill the clusterName and namespace when in KUBERNETES execution mode.
LookupProcessorIdentifier is not a direct API call, although it fires requests to get the result.
It's a helper which can be used as an input argument of the `DeleteProcessor` and `StopProcessor` and `ResumeProcessor` and `UpdateProcessorRunners` functions.

Fill the id or name in any case.
Fill the clusterName and namespace when in KUBERNETES execution mode.
// LookupProcessorIdentifier is not a direct API call although it fires requests to get the result . // It ' s a helper which can be used as an input argument of the ` DeleteProcessor ` and ` StopProcessor ` and ` ResumeProcessor ` and ` UpdateProcessorRunners ` functions . // // Fill the id or name in any case . // Fill the clusterName and namespace when in KUBERNETES execution mode .
func (c *Client) LookupProcessorIdentifier(id, name, clusterName, namespace string) (string, error) {
	if name == "" && id == "" {
		return "", fmt.Errorf("LookupProcessorIdentifier: name or id are missing")
	}
	mode, err := c.GetExecutionMode()
	if err != nil {
		return "", err 
	}
	identifier := name
	if mode == ExecutionModeInProcess {
		clusterName = "IN-PROC"
	}
	if mode == ExecutionModeConnect && clusterName == "" {
		return "", fmt.Errorf("`cluster-name` flag is empty")
	}
	if mode == ExecutionModeConnect || mode == ExecutionModeInProcess {
		if id != "" {
			identifier = id
		} else if name != "" {
			result, err := c.GetProcessors()
			if err != nil {
				return "", err
			}
			for _, processor := range result.Streams {
				if processor.Name == name && processor.ClusterName == clusterName {
					identifier = processor.ID
					break
				}
			}
		} else {
			return "", fmt.Errorf("LookupProcessorIdentifier: name or id arguments are missing")
		}
	} else if mode == ExecutionModeKubernetes {
		if id != "" {
			identifier = id
		} else {
			if clusterName == "" || namespace == "" || name == "" {
				return "", fmt.Errorf("LookupProcessorIdentifier:KUBERNETES: (name or clusterName or namespace) or id arguments are missing")
			}
			result, err := c.GetProcessors()
			if err != nil {
				return "", err
			}
			for _, processor := range result.Streams {
				if processor.Name == name && processor.ClusterName == clusterName && processor.Namespace == namespace {
					identifier = processor.ID
					break
				}
			}
		}
	}
	return identifier, nil
}
func ( c * Client ) LookupProcessorIdentifier ( id , name , clusterName , namespace string ) ( string , error ) { if name == " " && id == " " { return " " , fmt . Errorf ( " " ) } mode , err := c . GetExecutionMode ( ) if err != nil { return " " , err } identifier := name if mode == ExecutionModeInProcess { clusterName = " " } if mode == ExecutionModeConnect && clusterName == " " { return " " , fmt . Errorf ( " " ) } if mode == ExecutionModeConnect || mode == ExecutionModeInProcess { if id != " " { identifier = id } else if name != " " { result , err := c . GetProcessors ( ) if err != nil { return " " , err } for _ , processor := range result . Streams { if processor . Name == name && processor . ClusterName == clusterName { identifier = processor . ID break } } } else { return " " , fmt . Errorf ( " " ) } } else if mode == ExecutionModeKubernetes { if id != " " { identifier = id } else { if clusterName == " " || namespace == " " || name == " " { return " " , fmt . Errorf ( " " ) } result , err := c . GetProcessors ( ) if err != nil { return " " , err } for _ , processor := range result . Streams { if processor . Name == name && processor . ClusterName == clusterName && processor . Namespace == namespace { identifier = processor . ID break } } } } return identifier , nil }
LookupProcessorIdentifier is not a direct API call, although it fires requests to get the result.
LookupProcessorIdentifier is not a direct API call although it fires requests to get the result .
// unable to determinate the lenses execution mode. // get the id by looping over all available processors. // to match a processor by name in k8 mode we also need to match by both clusterName and namespace