func (wh *WorkflowHandler) ListWorkflowExecutions(
	ctx context.Context,
	listRequest *types.ListWorkflowExecutionsRequest,
) (resp *types.ListWorkflowExecutionsResponse, retError error) {
	defer log.CapturePanic(wh.GetLogger(), &retError)

	scope, sw := wh.startRequestProfileWithDomain(ctx, metrics.FrontendListWorkflowExecutionsScope, listRequest)
	defer sw.Stop()

	if wh.isShuttingDown() {
		return nil, errShuttingDown
	}

	if err := wh.versionChecker.ClientSupported(ctx, wh.config.EnableClientVersionCheck()); err != nil {
		return nil, wh.error(err, scope)
	}

	if listRequest == nil {
		return nil, wh.error(errRequestNotSet, scope)
	}

	if listRequest.GetDomain() == "" {
		return nil, wh.error(errDomainNotSet, scope)
	}

	if ok := wh.allow(true, listRequest); !ok {
		return nil, wh.error(createServiceBusyError(), scope)
	}

	if listRequest.GetPageSize() <= 0 {
		listRequest.PageSize = int32(wh.config.VisibilityMaxPageSize(listRequest.GetDomain()))
	}

	if wh.isListRequestPageSizeTooLarge(listRequest.GetPageSize(), listRequest.GetDomain()) {
		return nil, wh.error(&types.BadRequestError{
			Message: fmt.Sprintf("Pagesize is larger than allow %d", wh.config.ESIndexMaxResultWindow())}, scope)
	}

	validatedQuery, err := wh.visibilityQueryValidator.ValidateQuery(listRequest.GetQuery())
	if err != nil {
		return nil, wh.error(err, scope)
	}

	domain := listRequest.GetDomain()
	domainID, err := wh.GetDomainCache().GetDomainID(domain)
	if err != nil {
		return nil, wh.error(err, scope)
	}

	req := &persistence.ListWorkflowExecutionsByQueryRequest{
		DomainUUID:    domainID,
		Domain:        domain,
		PageSize:      int(listRequest.GetPageSize()),
		NextPageToken: listRequest.NextPageToken,
		Query:         validatedQuery,
	}
	persistenceResp, err := wh.GetVisibilityManager().ListWorkflowExecutions(ctx, req)
	if err != nil {
		return nil, wh.error(err, scope)
	}

	resp = &types.ListWorkflowExecutionsResponse{}
	resp.Executions = persistenceResp.Executions
	resp.NextPageToken = persistenceResp.NextPageToken
	return resp, nil
}
// ListWorkflowExecutions - retrieves info for workflow executions in a domain
retrieves info for workflow executions in a domain
// ListWorkflowExecutions - retrieves info for workflow executions in a domain
func (wh *WorkflowHandler) ListWorkflowExecutions(
	ctx context.Context,
	listRequest *types.ListWorkflowExecutionsRequest,
) (resp *types.ListWorkflowExecutionsResponse, retError error) {
	defer log.CapturePanic(wh.GetLogger(), &retError)
	scope, sw := wh.startRequestProfileWithDomain(ctx, metrics.FrontendListWorkflowExecutionsScope, listRequest)
	defer sw.Stop()
	if wh.isShuttingDown() {
		return nil, errShuttingDown
	}
	if err := wh.versionChecker.ClientSupported(ctx, wh.config.EnableClientVersionCheck()); err != nil {
		return nil, wh.error(err, scope)
	}
	if listRequest == nil {
		return nil, wh.error(errRequestNotSet, scope)
	}
	if listRequest.GetDomain() == "" {
		return nil, wh.error(errDomainNotSet, scope)
	}
	if ok := wh.allow(true, listRequest); !ok {
		return nil, wh.error(createServiceBusyError(), scope)
	}
	if listRequest.GetPageSize() <= 0 {
		listRequest.PageSize = int32(wh.config.VisibilityMaxPageSize(listRequest.GetDomain()))
	}
	if wh.isListRequestPageSizeTooLarge(listRequest.GetPageSize(), listRequest.GetDomain()) {
		return nil, wh.error(&types.BadRequestError{
			Message: fmt.Sprintf("Pagesize is larger than allow %d", wh.config.ESIndexMaxResultWindow())}, scope)
	}
	validatedQuery, err := wh.visibilityQueryValidator.ValidateQuery(listRequest.GetQuery())
	if err != nil {
		return nil, wh.error(err, scope)
	}
	domain := listRequest.GetDomain()
	domainID, err := wh.GetDomainCache().GetDomainID(domain)
	if err != nil {
		return nil, wh.error(err, scope)
	}
	req := &persistence.ListWorkflowExecutionsByQueryRequest{
		DomainUUID:    domainID,
		Domain:        domain,
		PageSize:      int(listRequest.GetPageSize()),
		NextPageToken: listRequest.NextPageToken,
		Query:         validatedQuery,
	}
	persistenceResp, err := wh.GetVisibilityManager().ListWorkflowExecutions(ctx, req)
	if err != nil {
		return nil, wh.error(err, scope)
	}
	resp = &types.ListWorkflowExecutionsResponse{}
	resp.Executions = persistenceResp.Executions
	resp.NextPageToken = persistenceResp.NextPageToken
	return resp, nil
}
func ( wh * WorkflowHandler ) ListWorkflowExecutions ( ctx context . Context , listRequest * types . ListWorkflowExecutionsRequest , ) ( resp * types . ListWorkflowExecutionsResponse , retError error ) { defer log . CapturePanic ( wh . GetLogger ( ) , & retError ) scope , sw := wh . startRequestProfileWithDomain ( ctx , metrics . FrontendListWorkflowExecutionsScope , listRequest ) defer sw . Stop ( ) if wh . isShuttingDown ( ) { return nil , errShuttingDown } if err := wh . versionChecker . ClientSupported ( ctx , wh . config . EnableClientVersionCheck ( ) ) ; err != nil { return nil , wh . error ( err , scope ) } if listRequest == nil { return nil , wh . error ( errRequestNotSet , scope ) } if listRequest . GetDomain ( ) == " " { return nil , wh . error ( errDomainNotSet , scope ) } if ok := wh . allow ( true , listRequest ) ; ! ok { return nil , wh . error ( createServiceBusyError ( ) , scope ) } if listRequest . GetPageSize ( ) <= 0 { listRequest . PageSize = int32 ( wh . config . VisibilityMaxPageSize ( listRequest . GetDomain ( ) ) ) } if wh . isListRequestPageSizeTooLarge ( listRequest . GetPageSize ( ) , listRequest . GetDomain ( ) ) { return nil , wh . error ( & types . BadRequestError { Message : fmt . Sprintf ( " " , wh . config . ESIndexMaxResultWindow ( ) ) } , scope ) } validatedQuery , err := wh . visibilityQueryValidator . ValidateQuery ( listRequest . GetQuery ( ) ) if err != nil { return nil , wh . error ( err , scope ) } domain := listRequest . GetDomain ( ) domainID , err := wh . GetDomainCache ( ) . GetDomainID ( domain ) if err != nil { return nil , wh . error ( err , scope ) } req := & persistence . ListWorkflowExecutionsByQueryRequest { DomainUUID : domainID , Domain : domain , PageSize : int ( listRequest . GetPageSize ( ) ) , NextPageToken : listRequest . NextPageToken , Query : validatedQuery , } persistenceResp , err := wh . GetVisibilityManager ( ) . ListWorkflowExecutions ( ctx , req ) if err != nil { return nil , wh . error ( err , scope ) } resp = & types . ListWorkflowExecutionsResponse { } resp . Executions = persistenceResp . Executions resp . NextPageToken = persistenceResp . NextPageToken return resp , nil }
retrieves info for workflow executions in a domain
retrieves info for workflow executions in a domain