func (i InvokeQueryUIObject) createInvokeQueryObjectForOrg(orgNames []string, action, tls string, organizations []inputStructs.Organization, invkQueryObject inputStructs.InvokeQuery) []InvokeQueryUIObject {
	var invokeQueryObjects []InvokeQueryUIObject
	invokeParams := make(map[string]Parameters)
	invokeCheck := "TRUE"
	if invkQueryObject.QueryCheck > 0 {
		invokeCheck = "FALSE"
	}
	i = InvokeQueryUIObject{
		LogLevel:    "ERROR",
		InvokeCheck: invokeCheck,
		TransType:   "Invoke",
		InvokeType:  "Move",
		TargetPeers: invkQueryObject.TargetPeers,
		TLS:         tls,
		NProcPerOrg: strconv.Itoa(invkQueryObject.NProcPerOrg),
		NRequest:    strconv.Itoa(invkQueryObject.NRequest),
		RunDur:      strconv.Itoa(invkQueryObject.RunDuration),
		CCType:      invkQueryObject.CCOptions.CCType,
		ChaincodeID: invkQueryObject.ChaincodeName,
		EventOpt: EventOptions{
			Type:     invkQueryObject.EventOptions.Type,
			Listener: invkQueryObject.EventOptions.Listener,
			TimeOut:  strconv.Itoa(invkQueryObject.EventOptions.TimeOut),
		},
		CCOpt: CCOptions{
			KeyIdx:      invkQueryObject.CCOptions.KeyIdx,
			KeyPayLoad:  invkQueryObject.CCOptions.KeyPayload,
			KeyStart:    strconv.Itoa(invkQueryObject.CCOptions.KeyStart),
			PayLoadMin:  strconv.Itoa(invkQueryObject.CCOptions.PayLoadMin),
			PayLoadMax:  strconv.Itoa(invkQueryObject.CCOptions.PayLoadMax),
			PayLoadType: invkQueryObject.CCOptions.PayLoadType,
		},
		TimeOutOpt: TimeOutOptions{
			Request:   invkQueryObject.TimeOutOpt.Request,
			PreConfig: invkQueryObject.TimeOutOpt.PreConfig,
		},
		ChannelOpt: ChannelOptions{
			Name:    invkQueryObject.ChannelName,
			OrgName: orgNames,
		},
		Snapshot: SnapshotOptions{
			Enabled:   invkQueryObject.SnapshotOpt.Enabled,
			Height:    invkQueryObject.SnapshotOpt.Height,
			QueryFreq: invkQueryObject.SnapshotOpt.QueryFrequency,
			ChannelID: invkQueryObject.ChannelName,
			PeerName:  invkQueryObject.SnapshotOpt.SnapshotPeer,
		},
		ConnProfilePath: paths.GetConnProfilePath(orgNames, organizations),
	}
	if strings.EqualFold("DISCOVERY", invkQueryObject.TargetPeers) {
		localHost := strings.ToUpper(strconv.FormatBool(invkQueryObject.DiscoveryOptions.Localhost))
		i.DiscoveryOpt = DiscoveryOptions{
			Localhost: localHost,
			InitFreq:  invkQueryObject.DiscoveryOptions.InitFreq,
		}
	}
	if strings.EqualFold("LIST", invkQueryObject.TargetPeers) {
		i.ListOpt = invkQueryObject.ListOptions
	}
	if action == "Query" {
		i.InvokeType = action
		i.CCOpt = CCOptions{KeyIdx: invkQueryObject.CCOptions.KeyIdx, KeyStart: strconv.Itoa(invkQueryObject.CCOptions.KeyStart)}
	}
	invokeParams["move"] = Parameters{
		Fcn:  invkQueryObject.Fcn,
		Args: strings.Split(invkQueryObject.Args, ","),
	}
	invokeParams["query"] = Parameters{
		Fcn:  invkQueryObject.Fcn,
		Args: strings.Split(invkQueryObject.Args, ","),
	}
	i.Parameters = invokeParams
	if invkQueryObject.PeerFailOver {
		i.PeerFailover = "TRUE"
		i.FailoverOpt = PeerOptions{
			Method: invkQueryObject.PeerOpt.Method,
			List:   invkQueryObject.PeerOpt.List,
		}
	}
	if invkQueryObject.OrdererFailOver {
		i.OrdererFailover = "TRUE"
		i.OrdererOpt = OrdererOptions{
			Method:    invkQueryObject.OrdererOpt.Method,
			NOrderers: invkQueryObject.OrdererOpt.NOrderers,
		}
	}
	for key := range invkQueryObject.TxnOptions {
		mode := invkQueryObject.TxnOptions[key].Mode
		options := invkQueryObject.TxnOptions[key].Options
		i.TransMode = mode
		switch mode {
		case "constant":
			i.ConstOpt = ConstantOptions{RecHist: "HIST", ConstFreq: strconv.Itoa(options.ConstFreq), DevFreq: strconv.Itoa(options.DevFreq)}
		case "burst":
			i.BurstOpt = BurstOptions{BurstFreq0: strconv.Itoa(options.BurstFreq0), BurstDur0: strconv.Itoa(options.BurstDur0), BurstFreq1: strconv.Itoa(options.BurstFreq1), BurstDur1: strconv.Itoa(options.BurstDur1)}
		case "mix":
			i.MixOpt = MixOptions{MixFreq: strconv.Itoa(options.MixFreq)}
		}
		invokeQueryObjects = append(invokeQueryObjects, i)
	}
	return invokeQueryObjects
}
createInvokeQueryObjectForOrg -- To craete invoke/query objects for an organization
package operations
import (
	"encoding/json"
	"fmt"
	"io/ioutil"
	"net/http"
	"net/url"
	"os"
	"regexp"
	"strconv"
	"strings"
	"sync"
	"time"
	"github.com/pkg/errors"
	"github.com/davecgh/go-spew/spew"
	"github.com/hyperledger/fabric-test/tools/operator/logger"
	"github.com/hyperledger/fabric-test/tools/operator/networkclient"
	"github.com/hyperledger/fabric-test/tools/operator/paths"
	"github.com/hyperledger/fabric-test/tools/operator/testclient/inputStructs"
)
type InvokeQueryUIObject struct {
	LogLevel        string                `json:"logLevel,omitempty"`
	ChaincodeID     string                `json:"chaincodeID,omitempty"`
	InvokeCheck     string                `json:"invokeCheck,omitempty"`
	TransMode       string                `json:"transMode,omitempty"`
	TransType       string                `json:"transType,omitempty"`
	InvokeType      string                `json:"invokeType,omitempty"`
	TargetPeers     string                `json:"targetPeers,omitempty"`
	TLS             string                `json:"TLS,omitempty"`
	NProcPerOrg     string                `json:"nProcPerOrg,omitempty"`
	NRequest        string                `json:"nRequest,omitempty"`
	RunDur          string                `json:"runDur,omitempty"`
	ChannelOpt      ChannelOptions        `json:"channelOpt,omitempty"`
	BurstOpt        BurstOptions          `json:"burstOpt,omitempty"`
	MixOpt          MixOptions            `json:"mixOpt,omitempty"`
	ConstOpt        ConstantOptions       `json:"constantOpt,omitempty"`
	EventOpt        EventOptions          `json:"eventOpt,omitempty"`
	DiscoveryOpt    DiscoveryOptions      `json:"discoveryOpt,omitempty"`
	ListOpt         map[string][]string   `json:"listOpt,omitempty"`
	CCType          string                `json:"ccType,omitempty"`
	CCOpt           CCOptions             `json:"ccOpt,omitempty"`
	Parameters      map[string]Parameters `json:"invoke,omitempty"`
	ConnProfilePath string                `json:"ConnProfilePath,omitempty"`
	TimeOutOpt      TimeOutOptions        `json:"timeoutOpt,timeoutOpt"`
	PeerFailover    string                `json:"peerFailover,omitempty"`
	OrdererFailover string                `json:"ordererFailover,omitempty"`
	FailoverOpt     PeerOptions           `json:"failoverOpt,omitempty"`
	OrdererOpt      OrdererOptions        `json:"ordererOpt,omitempty"`
	Snapshot        SnapshotOptions       `json:"snapshot,omitempty"`
}
type SnapshotOptions struct {
	Enabled   bool   `json:"enabled,omitempty"`
	Height    []int  `json:"height,omitempty"`
	QueryFreq int    `json:"queryFreq,omitempty"`
	PeerName  string `json:"peerName,omitempty"`
	ChannelID string `json:"channelID,omitempty"`
}
type BurstOptions struct {
	BurstFreq0 string `json:"burstFreq0,omitempty"`
	BurstDur0  string `json:"burstDur0,omitempty"`
	BurstFreq1 string `json:"burstFreq1,omitempty"`
	BurstDur1  string `json:"burstDur1,omitempty"`
}
type MixOptions struct {
	MixFreq string `json:"mixFreq,omitempty"`
}
type ConstantOptions struct {
	RecHist   string `json:"recHist,omitempty"`
	ConstFreq string `json:"constFreq,omitempty"`
	DevFreq   string `json:"devFreq,omitempty"`
}
type EventOptions struct {
	Type     string `json:"type,omitempty"`
	Listener string `json:"listener,omitempty"`
	TimeOut  string `json:"timeout,omitempty"`
}
type CCOptions struct {
	KeyIdx      []int  `json:"keyIdx,omitempty"`
	KeyPayLoad  []int  `json:"keyPayLoad,omitempty"`
	KeyStart    string `json:"keyStart,omitempty"`
	PayLoadMin  string `json:"payLoadMin,omitempty"`
	PayLoadMax  string `json:"payLoadMax,omitempty"`
	PayLoadType string `json:"payLoadType,omitempty"`
}
type DiscoveryOptions struct {
	Localhost string `json:"localHost,omitempty"`
	InitFreq  int    `json:"initFreq,omitempty"`
}
type Parameters struct {
	Fcn  string   `json:"fcn,omitempty"`
	Args []string `json:"args,omitempty"`
}
type PeerOptions struct {
	Method string `json:"method,omitempty"`
	List   string `json:"list,omitempty"`
}
type OrdererOptions struct {
	Method    string `json:"method,omitempty"`
	NOrderers int    `json:"nOrderers,omitempty"`
}
type BlockchainCount struct {
	peerTransactionCount int
	peerBlockchainHeight int
	peerBlockHash        string
}
type Result struct {
	Err error
}
func (i InvokeQueryUIObject) InvokeQuery(config inputStructs.Config, tls, action string) error {
	var invokeQueryObjects []InvokeQueryUIObject
	configObjects := config.Invoke
	if action == "Query" {
		configObjects = config.Query
	}
	fmt.Printf("\033[1m\nAction:%s\nInput:\033[0m\n%s\n", action, spew.Sdump(configObjects))
	for key := range configObjects {
		invkQueryObjects := i.generateInvokeQueryObjects(configObjects[key], config.Organizations, tls, action)
		invokeQueryObjects = append(invokeQueryObjects, invkQueryObjects...)
	}
	return i.invokeQueryTransactions(invokeQueryObjects)
}
func (i InvokeQueryUIObject) generateInvokeQueryObjects(invkQueryObject inputStructs.InvokeQuery, organizations []inputStructs.Organization, tls, action string) []InvokeQueryUIObject {
	var invokeQueryObjects []InvokeQueryUIObject
	orgNames := strings.Split(invkQueryObject.Organizations, ",")
	invkQueryObjects := i.createInvokeQueryObjectForOrg(orgNames, action, tls, organizations, invkQueryObject)
	invokeQueryObjects = append(invokeQueryObjects, invkQueryObjects...)
	return invokeQueryObjects
}