176
177
// nolint:revive,cognitive-complexity
178
>
func ValidateBatchOperation(params *workflowservice.StartBatchOperationRequest) error {
workflow.go
179
>
numTargetSelectors := 0
180
>
if len(params.GetVisibilityQuery()) != 0 {
181
numTargetSelectors++
182
}
183
//nolint:staticcheck // SA1019: Executions is deprecated but still a valid, mutually exclusive target selector
184
>
if len(params.GetExecutions()) != 0 {
workflow.go
185
numTargetSelectors++
186
}
187
>
if len(params.GetTargetExecutions()) != 0 {
workflow.go
188
numTargetSelectors++
189
}
190
192
>
params.GetReason() == "" ||
193
>
params.GetNamespace() == "" ||
194
>
numTargetSelectors == 0 {
195
return serviceerror.NewInvalidArgument("must provide required parameters: BatchType,Reason,Namespace, AND one of (Query OR Executions OR TargetExecutions)")
196
}
197
199
return serviceerror.NewInvalidArgument("JobId is not set on request.")
200
}