Ejemplo n.º 1
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := kibitz.NewRecommenderServiceClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "createNewIndividualServer":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "CreateNewIndividualServer requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.CreateNewIndividualServer(value0))
		fmt.Print("\n")
		break
	case "terminateSession":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TerminateSession requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.TerminateSession(value0))
		fmt.Print("\n")
		break
	case "makeRecommendation":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "MakeRecommendation requires 5 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1, err94 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err94 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2, err95 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err95 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		arg97 := flag.Arg(5)
		mbTrans98 := thrift.NewTMemoryBufferLen(len(arg97))
		defer mbTrans98.Close()
		_, err99 := mbTrans98.WriteString(arg97)
		if err99 != nil {
			Usage()
			return
		}
		factory100 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt101 := factory100.GetProtocol(mbTrans98)
		containerStruct4 := kibitz.NewMakeRecommendationArgs()
		err102 := containerStruct4.ReadField5(jsProt101)
		if err102 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.DisplayColumns
		value4 := argvalue4
		fmt.Print(client.MakeRecommendation(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "makeItemBasedRecommendations":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "MakeItemBasedRecommendations requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1, err104 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err104 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2, err105 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err105 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg106 := flag.Arg(4)
		mbTrans107 := thrift.NewTMemoryBufferLen(len(arg106))
		defer mbTrans107.Close()
		_, err108 := mbTrans107.WriteString(arg106)
		if err108 != nil {
			Usage()
			return
		}
		factory109 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt110 := factory109.GetProtocol(mbTrans107)
		containerStruct3 := kibitz.NewMakeItemBasedRecommendationsArgs()
		err111 := containerStruct3.ReadField4(jsProt110)
		if err111 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.DisplayColumns
		value3 := argvalue3
		fmt.Print(client.MakeItemBasedRecommendations(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getPageItems":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetPageItems requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1, err113 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err113 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2, err114 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err114 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg115 := flag.Arg(4)
		mbTrans116 := thrift.NewTMemoryBufferLen(len(arg115))
		defer mbTrans116.Close()
		_, err117 := mbTrans116.WriteString(arg115)
		if err117 != nil {
			Usage()
			return
		}
		factory118 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt119 := factory118.GetProtocol(mbTrans116)
		containerStruct3 := kibitz.NewGetPageItemsArgs()
		err120 := containerStruct3.ReadField4(jsProt119)
		if err120 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.DisplayColumns
		value3 := argvalue3
		fmt.Print(client.GetPageItems(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getItemCount":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetItemCount requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetItemCount(value0))
		fmt.Print("\n")
		break
	case "recordRatings":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "RecordRatings requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1, err123 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err123 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2, err124 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err124 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		argvalue3, err125 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err125 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.RecordRatings(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "deleteRatings":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "DeleteRatings requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1, err127 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err127 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2, err128 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err128 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.DeleteRatings(value0, value1, value2))
		fmt.Print("\n")
		break
	case "createNewUser":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "CreateNewUser requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3) == "true"
		value2 := argvalue2
		fmt.Print(client.CreateNewUser(value0, value1, value2))
		fmt.Print("\n")
		break
	case "checkUsername":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "CheckUsername requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3) == "true"
		value2 := argvalue2
		fmt.Print(client.CheckUsername(value0, value1, value2))
		fmt.Print("\n")
		break
	case "checkLogin":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "CheckLogin requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		fmt.Print(client.CheckLogin(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "retrieveUserId":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "RetrieveUserId requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.RetrieveUserId(value0, value1))
		fmt.Print("\n")
		break
	case "createNewRecommender":
		if flag.NArg()-1 != 9 {
			fmt.Fprintln(os.Stderr, "CreateNewRecommender requires 9 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		argvalue4 := flag.Arg(5)
		value4 := argvalue4
		argvalue5 := flag.Arg(6)
		value5 := argvalue5
		argvalue6 := flag.Arg(7)
		value6 := argvalue6
		argvalue7 := flag.Arg(8)
		value7 := argvalue7
		argvalue8 := flag.Arg(9)
		value8 := argvalue8
		fmt.Print(client.CreateNewRecommender(value0, value1, value2, value3, value4, value5, value6, value7, value8))
		fmt.Print("\n")
		break
	case "getUserRatedItems":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "GetUserRatedItems requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1, err151 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err151 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg152 := flag.Arg(3)
		mbTrans153 := thrift.NewTMemoryBufferLen(len(arg152))
		defer mbTrans153.Close()
		_, err154 := mbTrans153.WriteString(arg152)
		if err154 != nil {
			Usage()
			return
		}
		factory155 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt156 := factory155.GetProtocol(mbTrans153)
		containerStruct2 := kibitz.NewGetUserRatedItemsArgs()
		err157 := containerStruct2.ReadField3(jsProt156)
		if err157 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.DisplayColumns
		value2 := argvalue2
		fmt.Print(client.GetUserRatedItems(value0, value1, value2))
		fmt.Print("\n")
		break
	case "initiateModel":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "InitiateModel requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		fmt.Print(client.InitiateModel(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getSearchItems":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetSearchItems requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg164 := flag.Arg(3)
		mbTrans165 := thrift.NewTMemoryBufferLen(len(arg164))
		defer mbTrans165.Close()
		_, err166 := mbTrans165.WriteString(arg164)
		if err166 != nil {
			Usage()
			return
		}
		factory167 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt168 := factory167.GetProtocol(mbTrans165)
		containerStruct2 := kibitz.NewGetSearchItemsArgs()
		err169 := containerStruct2.ReadField3(jsProt168)
		if err169 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.ColumnsToSearch
		value2 := argvalue2
		arg170 := flag.Arg(4)
		mbTrans171 := thrift.NewTMemoryBufferLen(len(arg170))
		defer mbTrans171.Close()
		_, err172 := mbTrans171.WriteString(arg170)
		if err172 != nil {
			Usage()
			return
		}
		factory173 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt174 := factory173.GetProtocol(mbTrans171)
		containerStruct3 := kibitz.NewGetSearchItemsArgs()
		err175 := containerStruct3.ReadField4(jsProt174)
		if err175 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.DisplayColumns
		value3 := argvalue3
		fmt.Print(client.GetSearchItems(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "makeOverallRatingBasedOrRandomRecommendation":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "MakeOverallRatingBasedOrRandomRecommendation requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2, err178 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err178 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg179 := flag.Arg(4)
		mbTrans180 := thrift.NewTMemoryBufferLen(len(arg179))
		defer mbTrans180.Close()
		_, err181 := mbTrans180.WriteString(arg179)
		if err181 != nil {
			Usage()
			return
		}
		factory182 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt183 := factory182.GetProtocol(mbTrans180)
		containerStruct3 := kibitz.NewMakeOverallRatingBasedOrRandomRecommendationArgs()
		err184 := containerStruct3.ReadField4(jsProt183)
		if err184 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.DisplayColumns
		value3 := argvalue3
		fmt.Print(client.MakeOverallRatingBasedOrRandomRecommendation(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "addKibitzUser":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "AddKibitzUser requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.AddKibitzUser(value0, value1))
		fmt.Print("\n")
		break
	case "checkCorrectDatahubLogin":
		if flag.NArg()-1 != 7 {
			fmt.Fprintln(os.Stderr, "CheckCorrectDatahubLogin requires 7 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		argvalue4 := flag.Arg(5)
		value4 := argvalue4
		argvalue5 := flag.Arg(6)
		value5 := argvalue5
		argvalue6 := flag.Arg(7)
		value6 := argvalue6
		fmt.Print(client.CheckCorrectDatahubLogin(value0, value1, value2, value3, value4, value5, value6))
		fmt.Print("\n")
		break
	case "checkRatingsColumn":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "CheckRatingsColumn requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		fmt.Print(client.CheckRatingsColumn(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getRecommenders":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetRecommenders requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetRecommenders(value0))
		fmt.Print("\n")
		break
	case "getProfilePicture":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetProfilePicture requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetProfilePicture(value0))
		fmt.Print("\n")
		break
	case "saveFBProfilePic":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "SaveFBProfilePic requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.SaveFBProfilePic(value0, value1))
		fmt.Print("\n")
		break
	case "deleteRecommender":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "DeleteRecommender requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.DeleteRecommender(value0))
		fmt.Print("\n")
		break
	case "updateTemplate":
		if flag.NArg()-1 != 17 {
			fmt.Fprintln(os.Stderr, "UpdateTemplate requires 17 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		argvalue4 := flag.Arg(5)
		value4 := argvalue4
		argvalue5 := flag.Arg(6)
		value5 := argvalue5
		arg209 := flag.Arg(7)
		mbTrans210 := thrift.NewTMemoryBufferLen(len(arg209))
		defer mbTrans210.Close()
		_, err211 := mbTrans210.WriteString(arg209)
		if err211 != nil {
			Usage()
			return
		}
		factory212 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt213 := factory212.GetProtocol(mbTrans210)
		containerStruct6 := kibitz.NewUpdateTemplateArgs()
		err214 := containerStruct6.ReadField7(jsProt213)
		if err214 != nil {
			Usage()
			return
		}
		argvalue6 := containerStruct6.ItemTypes
		value6 := argvalue6
		arg215 := flag.Arg(8)
		mbTrans216 := thrift.NewTMemoryBufferLen(len(arg215))
		defer mbTrans216.Close()
		_, err217 := mbTrans216.WriteString(arg215)
		if err217 != nil {
			Usage()
			return
		}
		factory218 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt219 := factory218.GetProtocol(mbTrans216)
		containerStruct7 := kibitz.NewUpdateTemplateArgs()
		err220 := containerStruct7.ReadField8(jsProt219)
		if err220 != nil {
			Usage()
			return
		}
		argvalue7 := containerStruct7.DisplayItems
		value7 := argvalue7
		argvalue8, err221 := (strconv.ParseInt(flag.Arg(9), 10, 64))
		if err221 != nil {
			Usage()
			return
		}
		value8 := argvalue8
		argvalue9, err222 := (strconv.ParseInt(flag.Arg(10), 10, 64))
		if err222 != nil {
			Usage()
			return
		}
		value9 := argvalue9
		argvalue10 := flag.Arg(11)
		value10 := argvalue10
		argvalue11 := flag.Arg(12)
		value11 := argvalue11
		argvalue12 := flag.Arg(13)
		value12 := argvalue12
		argvalue13 := flag.Arg(14)
		value13 := argvalue13
		argvalue14 := flag.Arg(15)
		value14 := argvalue14
		argvalue15 := flag.Arg(16)
		value15 := argvalue15
		argvalue16 := flag.Arg(17)
		value16 := argvalue16
		fmt.Print(client.UpdateTemplate(value0, value1, value2, value3, value4, value5, value6, value7, value8, value9, value10, value11, value12, value13, value14, value15, value16))
		fmt.Print("\n")
		break
	case "configurePrefilledUserRatings":
		if flag.NArg()-1 != 8 {
			fmt.Fprintln(os.Stderr, "ConfigurePrefilledUserRatings requires 8 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		argvalue4 := flag.Arg(5)
		value4 := argvalue4
		argvalue5 := flag.Arg(6)
		value5 := argvalue5
		argvalue6 := flag.Arg(7)
		value6 := argvalue6
		argvalue7 := flag.Arg(8)
		value7 := argvalue7
		fmt.Print(client.ConfigurePrefilledUserRatings(value0, value1, value2, value3, value4, value5, value6, value7))
		fmt.Print("\n")
		break
	case "getTables":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetTables requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.GetTables(value0, value1))
		fmt.Print("\n")
		break
	case "getColumns":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "GetColumns requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.GetColumns(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getFirstRepo":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetFirstRepo requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetFirstRepo(value0))
		fmt.Print("\n")
		break
	case "getNumRepos":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetNumRepos requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetNumRepos(value0))
		fmt.Print("\n")
		break
	case "getAllRepos":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetAllRepos requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetAllRepos(value0))
		fmt.Print("\n")
		break
	case "saveCSSData":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "SaveCSSData requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.SaveCSSData(value0, value1))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 2
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := servicessync.NewComplaintManagerSyncClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "addComplaint":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "AddComplaint requires 1 args")
			flag.Usage()
		}
		arg779 := flag.Arg(1)
		mbTrans780 := thrift.NewTMemoryBufferLen(len(arg779))
		defer mbTrans780.Close()
		_, err781 := mbTrans780.WriteString(arg779)
		if err781 != nil {
			Usage()
			return
		}
		factory782 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt783 := factory782.GetProtocol(mbTrans780)
		argvalue0 := servicessync.NewComplaint()
		err784 := argvalue0.Read(jsProt783)
		if err784 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.AddComplaint(value0))
		fmt.Print("\n")
		break
	case "getComplaints":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "GetComplaints requires 6 args")
			flag.Usage()
		}
		argvalue0, err785 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err785 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err786 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err786 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := servicessync.ComplaintType(tmp2)
		value2 := argvalue2
		argvalue3, err787 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err787 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		argvalue4 := flag.Arg(5) == "true"
		value4 := argvalue4
		tmp5, err789 := (strconv.Atoi(flag.Arg(6)))
		if err789 != nil {
			Usage()
			return
		}
		argvalue5 := int32(tmp5)
		value5 := argvalue5
		fmt.Print(client.GetComplaints(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "updateComplaint":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateComplaint requires 2 args")
			flag.Usage()
		}
		arg790 := flag.Arg(1)
		mbTrans791 := thrift.NewTMemoryBufferLen(len(arg790))
		defer mbTrans791.Close()
		_, err792 := mbTrans791.WriteString(arg790)
		if err792 != nil {
			Usage()
			return
		}
		factory793 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt794 := factory793.GetProtocol(mbTrans791)
		argvalue0 := servicessync.NewComplaint()
		err795 := argvalue0.Read(jsProt794)
		if err795 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err796 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err796 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateComplaint(value0, value1))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := shared.NewSharedServiceClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "getStruct":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetStruct requires 1 args")
			flag.Usage()
		}
		tmp0, err4 := (strconv.Atoi(flag.Arg(1)))
		if err4 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		fmt.Print(client.GetStruct(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 4
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := service.NewSystemServiceClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "ActiveFontUser":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ActiveFontUser requires 2 args")
			flag.Usage()
		}
		tmp0, err28 := (strconv.Atoi(flag.Arg(1)))
		if err28 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		argvalue1 := flag.Arg(2) == "true"
		value1 := argvalue1
		fmt.Print(client.ActiveFontUser(value0, value1))
		fmt.Print("\n")
		break
	case "FindApplyFormByUnit":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "FindApplyFormByUnit requires 1 args")
			flag.Usage()
		}
		tmp0, err30 := (strconv.Atoi(flag.Arg(1)))
		if err30 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		fmt.Print(client.FindApplyFormByUnit(value0))
		fmt.Print("\n")
		break
	case "PushBoxStatus":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "PushBoxStatus requires 1 args")
			flag.Usage()
		}
		arg31 := flag.Arg(1)
		mbTrans32 := thrift.NewTMemoryBufferLen(len(arg31))
		defer mbTrans32.Close()
		_, err33 := mbTrans32.WriteString(arg31)
		if err33 != nil {
			Usage()
			return
		}
		factory34 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt35 := factory34.GetProtocol(mbTrans32)
		argvalue0 := service.NewBoxStatus()
		err36 := argvalue0.Read(jsProt35)
		if err36 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.PushBoxStatus(value0))
		fmt.Print("\n")
		break
	case "DeleteApplyForm":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "DeleteApplyForm requires 1 args")
			flag.Usage()
		}
		tmp0, err37 := (strconv.Atoi(flag.Arg(1)))
		if err37 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		fmt.Print(client.DeleteApplyForm(value0))
		fmt.Print("\n")
		break
	case "ApproveApplyForm":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ApproveApplyForm requires 1 args")
			flag.Usage()
		}
		tmp0, err38 := (strconv.Atoi(flag.Arg(1)))
		if err38 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		fmt.Print(client.ApproveApplyForm(value0))
		fmt.Print("\n")
		break
	case "CreateUnit":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "CreateUnit requires 1 args")
			flag.Usage()
		}
		arg39 := flag.Arg(1)
		mbTrans40 := thrift.NewTMemoryBufferLen(len(arg39))
		defer mbTrans40.Close()
		_, err41 := mbTrans40.WriteString(arg39)
		if err41 != nil {
			Usage()
			return
		}
		factory42 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt43 := factory42.GetProtocol(mbTrans40)
		argvalue0 := service.NewUnit()
		err44 := argvalue0.Read(jsProt43)
		if err44 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.CreateUnit(value0))
		fmt.Print("\n")
		break
	case "DeleteUnit":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "DeleteUnit requires 1 args")
			flag.Usage()
		}
		tmp0, err45 := (strconv.Atoi(flag.Arg(1)))
		if err45 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		fmt.Print(client.DeleteUnit(value0))
		fmt.Print("\n")
		break
	case "FindUnitById":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "FindUnitById requires 1 args")
			flag.Usage()
		}
		tmp0, err46 := (strconv.Atoi(flag.Arg(1)))
		if err46 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		fmt.Print(client.FindUnitById(value0))
		fmt.Print("\n")
		break
	case "FindUnitByName":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "FindUnitByName requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2) == "true"
		value1 := argvalue1
		fmt.Print(client.FindUnitByName(value0, value1))
		fmt.Print("\n")
		break
	case "SendSms":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "SendSms requires 2 args")
			flag.Usage()
		}
		tmp0, err49 := (strconv.Atoi(flag.Arg(1)))
		if err49 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.SendSms(value0, value1))
		fmt.Print("\n")
		break
	case "PushOfflineHistory":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "PushOfflineHistory requires 1 args")
			flag.Usage()
		}
		arg51 := flag.Arg(1)
		mbTrans52 := thrift.NewTMemoryBufferLen(len(arg51))
		defer mbTrans52.Close()
		_, err53 := mbTrans52.WriteString(arg51)
		if err53 != nil {
			Usage()
			return
		}
		factory54 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt55 := factory54.GetProtocol(mbTrans52)
		containerStruct0 := service.NewSystemServicePushOfflineHistoryArgs()
		err56 := containerStruct0.ReadField1(jsProt55)
		if err56 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.History
		value0 := argvalue0
		fmt.Print(client.PushOfflineHistory(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 5
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := services.NewPushManagerClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "enablePushNotification":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "EnablePushNotification requires 4 args")
			flag.Usage()
		}
		argvalue0, err1535 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err1535 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3) == "true"
		value2 := argvalue2
		arg1538 := flag.Arg(4)
		mbTrans1539 := thrift.NewTMemoryBufferLen(len(arg1538))
		defer mbTrans1539.Close()
		_, err1540 := mbTrans1539.WriteString(arg1538)
		if err1540 != nil {
			Usage()
			return
		}
		factory1541 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1542 := factory1541.GetProtocol(mbTrans1539)
		argvalue3 := services.NewFromInfo()
		err1543 := argvalue3.Read(jsProt1542)
		if err1543 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.EnablePushNotification(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 6
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := notestore.NewNoteStoreClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "getSyncState":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetSyncState requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetSyncState(value0))
		fmt.Print("\n")
		break
	case "getSyncStateWithMetrics":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetSyncStateWithMetrics requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg194 := flag.Arg(2)
		mbTrans195 := thrift.NewTMemoryBufferLen(len(arg194))
		defer mbTrans195.Close()
		_, err196 := mbTrans195.WriteString(arg194)
		if err196 != nil {
			Usage()
			return
		}
		factory197 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt198 := factory197.GetProtocol(mbTrans195)
		argvalue1 := notestore.NewClientUsageMetrics()
		err199 := argvalue1.Read(jsProt198)
		if err199 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.GetSyncStateWithMetrics(value0, value1))
		fmt.Print("\n")
		break
	case "getSyncChunk":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetSyncChunk requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err201 := (strconv.Atoi(flag.Arg(2)))
		if err201 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		tmp2, err202 := (strconv.Atoi(flag.Arg(3)))
		if err202 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		fmt.Print(client.GetSyncChunk(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getFilteredSyncChunk":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetFilteredSyncChunk requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err205 := (strconv.Atoi(flag.Arg(2)))
		if err205 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		tmp2, err206 := (strconv.Atoi(flag.Arg(3)))
		if err206 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		arg207 := flag.Arg(4)
		mbTrans208 := thrift.NewTMemoryBufferLen(len(arg207))
		defer mbTrans208.Close()
		_, err209 := mbTrans208.WriteString(arg207)
		if err209 != nil {
			Usage()
			return
		}
		factory210 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt211 := factory210.GetProtocol(mbTrans208)
		argvalue3 := notestore.NewSyncChunkFilter()
		err212 := argvalue3.Read(jsProt211)
		if err212 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.GetFilteredSyncChunk(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getLinkedNotebookSyncState":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetLinkedNotebookSyncState requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg214 := flag.Arg(2)
		mbTrans215 := thrift.NewTMemoryBufferLen(len(arg214))
		defer mbTrans215.Close()
		_, err216 := mbTrans215.WriteString(arg214)
		if err216 != nil {
			Usage()
			return
		}
		factory217 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt218 := factory217.GetProtocol(mbTrans215)
		argvalue1 := types.NewLinkedNotebook()
		err219 := argvalue1.Read(jsProt218)
		if err219 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.GetLinkedNotebookSyncState(value0, value1))
		fmt.Print("\n")
		break
	case "getLinkedNotebookSyncChunk":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "GetLinkedNotebookSyncChunk requires 5 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg221 := flag.Arg(2)
		mbTrans222 := thrift.NewTMemoryBufferLen(len(arg221))
		defer mbTrans222.Close()
		_, err223 := mbTrans222.WriteString(arg221)
		if err223 != nil {
			Usage()
			return
		}
		factory224 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt225 := factory224.GetProtocol(mbTrans222)
		argvalue1 := types.NewLinkedNotebook()
		err226 := argvalue1.Read(jsProt225)
		if err226 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err227 := (strconv.Atoi(flag.Arg(3)))
		if err227 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		tmp3, err228 := (strconv.Atoi(flag.Arg(4)))
		if err228 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		argvalue4 := flag.Arg(5) == "true"
		value4 := argvalue4
		fmt.Print(client.GetLinkedNotebookSyncChunk(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "listNotebooks":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ListNotebooks requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.ListNotebooks(value0))
		fmt.Print("\n")
		break
	case "getNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.GetNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "getDefaultNotebook":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetDefaultNotebook requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetDefaultNotebook(value0))
		fmt.Print("\n")
		break
	case "createNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CreateNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg235 := flag.Arg(2)
		mbTrans236 := thrift.NewTMemoryBufferLen(len(arg235))
		defer mbTrans236.Close()
		_, err237 := mbTrans236.WriteString(arg235)
		if err237 != nil {
			Usage()
			return
		}
		factory238 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt239 := factory238.GetProtocol(mbTrans236)
		argvalue1 := types.NewNotebook()
		err240 := argvalue1.Read(jsProt239)
		if err240 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.CreateNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "updateNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg242 := flag.Arg(2)
		mbTrans243 := thrift.NewTMemoryBufferLen(len(arg242))
		defer mbTrans243.Close()
		_, err244 := mbTrans243.WriteString(arg242)
		if err244 != nil {
			Usage()
			return
		}
		factory245 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt246 := factory245.GetProtocol(mbTrans243)
		argvalue1 := types.NewNotebook()
		err247 := argvalue1.Read(jsProt246)
		if err247 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "expungeNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ExpungeNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.ExpungeNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "listTags":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ListTags requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.ListTags(value0))
		fmt.Print("\n")
		break
	case "listTagsByNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ListTagsByNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.ListTagsByNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "getTag":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetTag requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.GetTag(value0, value1))
		fmt.Print("\n")
		break
	case "createTag":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CreateTag requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg256 := flag.Arg(2)
		mbTrans257 := thrift.NewTMemoryBufferLen(len(arg256))
		defer mbTrans257.Close()
		_, err258 := mbTrans257.WriteString(arg256)
		if err258 != nil {
			Usage()
			return
		}
		factory259 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt260 := factory259.GetProtocol(mbTrans257)
		argvalue1 := types.NewTag()
		err261 := argvalue1.Read(jsProt260)
		if err261 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.CreateTag(value0, value1))
		fmt.Print("\n")
		break
	case "updateTag":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateTag requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg263 := flag.Arg(2)
		mbTrans264 := thrift.NewTMemoryBufferLen(len(arg263))
		defer mbTrans264.Close()
		_, err265 := mbTrans264.WriteString(arg263)
		if err265 != nil {
			Usage()
			return
		}
		factory266 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt267 := factory266.GetProtocol(mbTrans264)
		argvalue1 := types.NewTag()
		err268 := argvalue1.Read(jsProt267)
		if err268 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateTag(value0, value1))
		fmt.Print("\n")
		break
	case "untagAll":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UntagAll requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.UntagAll(value0, value1))
		fmt.Print("\n")
		break
	case "expungeTag":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ExpungeTag requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.ExpungeTag(value0, value1))
		fmt.Print("\n")
		break
	case "listSearches":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ListSearches requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.ListSearches(value0))
		fmt.Print("\n")
		break
	case "getSearch":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetSearch requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.GetSearch(value0, value1))
		fmt.Print("\n")
		break
	case "createSearch":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CreateSearch requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg277 := flag.Arg(2)
		mbTrans278 := thrift.NewTMemoryBufferLen(len(arg277))
		defer mbTrans278.Close()
		_, err279 := mbTrans278.WriteString(arg277)
		if err279 != nil {
			Usage()
			return
		}
		factory280 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt281 := factory280.GetProtocol(mbTrans278)
		argvalue1 := types.NewSavedSearch()
		err282 := argvalue1.Read(jsProt281)
		if err282 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.CreateSearch(value0, value1))
		fmt.Print("\n")
		break
	case "updateSearch":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateSearch requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg284 := flag.Arg(2)
		mbTrans285 := thrift.NewTMemoryBufferLen(len(arg284))
		defer mbTrans285.Close()
		_, err286 := mbTrans285.WriteString(arg284)
		if err286 != nil {
			Usage()
			return
		}
		factory287 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt288 := factory287.GetProtocol(mbTrans285)
		argvalue1 := types.NewSavedSearch()
		err289 := argvalue1.Read(jsProt288)
		if err289 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateSearch(value0, value1))
		fmt.Print("\n")
		break
	case "expungeSearch":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ExpungeSearch requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.ExpungeSearch(value0, value1))
		fmt.Print("\n")
		break
	case "findNotes":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "FindNotes requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg293 := flag.Arg(2)
		mbTrans294 := thrift.NewTMemoryBufferLen(len(arg293))
		defer mbTrans294.Close()
		_, err295 := mbTrans294.WriteString(arg293)
		if err295 != nil {
			Usage()
			return
		}
		factory296 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt297 := factory296.GetProtocol(mbTrans294)
		argvalue1 := notestore.NewNoteFilter()
		err298 := argvalue1.Read(jsProt297)
		if err298 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err299 := (strconv.Atoi(flag.Arg(3)))
		if err299 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		tmp3, err300 := (strconv.Atoi(flag.Arg(4)))
		if err300 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		fmt.Print(client.FindNotes(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "findNoteOffset":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "FindNoteOffset requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg302 := flag.Arg(2)
		mbTrans303 := thrift.NewTMemoryBufferLen(len(arg302))
		defer mbTrans303.Close()
		_, err304 := mbTrans303.WriteString(arg302)
		if err304 != nil {
			Usage()
			return
		}
		factory305 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt306 := factory305.GetProtocol(mbTrans303)
		argvalue1 := notestore.NewNoteFilter()
		err307 := argvalue1.Read(jsProt306)
		if err307 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := types.GUID(argvalue2)
		fmt.Print(client.FindNoteOffset(value0, value1, value2))
		fmt.Print("\n")
		break
	case "findNotesMetadata":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "FindNotesMetadata requires 5 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg310 := flag.Arg(2)
		mbTrans311 := thrift.NewTMemoryBufferLen(len(arg310))
		defer mbTrans311.Close()
		_, err312 := mbTrans311.WriteString(arg310)
		if err312 != nil {
			Usage()
			return
		}
		factory313 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt314 := factory313.GetProtocol(mbTrans311)
		argvalue1 := notestore.NewNoteFilter()
		err315 := argvalue1.Read(jsProt314)
		if err315 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err316 := (strconv.Atoi(flag.Arg(3)))
		if err316 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		tmp3, err317 := (strconv.Atoi(flag.Arg(4)))
		if err317 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		arg318 := flag.Arg(5)
		mbTrans319 := thrift.NewTMemoryBufferLen(len(arg318))
		defer mbTrans319.Close()
		_, err320 := mbTrans319.WriteString(arg318)
		if err320 != nil {
			Usage()
			return
		}
		factory321 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt322 := factory321.GetProtocol(mbTrans319)
		argvalue4 := notestore.NewNotesMetadataResultSpec()
		err323 := argvalue4.Read(jsProt322)
		if err323 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		fmt.Print(client.FindNotesMetadata(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "findNoteCounts":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "FindNoteCounts requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg325 := flag.Arg(2)
		mbTrans326 := thrift.NewTMemoryBufferLen(len(arg325))
		defer mbTrans326.Close()
		_, err327 := mbTrans326.WriteString(arg325)
		if err327 != nil {
			Usage()
			return
		}
		factory328 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt329 := factory328.GetProtocol(mbTrans326)
		argvalue1 := notestore.NewNoteFilter()
		err330 := argvalue1.Read(jsProt329)
		if err330 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2 := flag.Arg(3) == "true"
		value2 := argvalue2
		fmt.Print(client.FindNoteCounts(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getNote":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "GetNote requires 6 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		argvalue2 := flag.Arg(3) == "true"
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		argvalue4 := flag.Arg(5) == "true"
		value4 := argvalue4
		argvalue5 := flag.Arg(6) == "true"
		value5 := argvalue5
		fmt.Print(client.GetNote(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "getNoteApplicationData":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetNoteApplicationData requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.GetNoteApplicationData(value0, value1))
		fmt.Print("\n")
		break
	case "getNoteApplicationDataEntry":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "GetNoteApplicationDataEntry requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.GetNoteApplicationDataEntry(value0, value1, value2))
		fmt.Print("\n")
		break
	case "setNoteApplicationDataEntry":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "SetNoteApplicationDataEntry requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		fmt.Print(client.SetNoteApplicationDataEntry(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "unsetNoteApplicationDataEntry":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "UnsetNoteApplicationDataEntry requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.UnsetNoteApplicationDataEntry(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getNoteContent":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetNoteContent requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.GetNoteContent(value0, value1))
		fmt.Print("\n")
		break
	case "getNoteSearchText":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetNoteSearchText requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		argvalue2 := flag.Arg(3) == "true"
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		fmt.Print(client.GetNoteSearchText(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getResourceSearchText":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetResourceSearchText requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.GetResourceSearchText(value0, value1))
		fmt.Print("\n")
		break
	case "getNoteTagNames":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetNoteTagNames requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.GetNoteTagNames(value0, value1))
		fmt.Print("\n")
		break
	case "createNote":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CreateNote requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg361 := flag.Arg(2)
		mbTrans362 := thrift.NewTMemoryBufferLen(len(arg361))
		defer mbTrans362.Close()
		_, err363 := mbTrans362.WriteString(arg361)
		if err363 != nil {
			Usage()
			return
		}
		factory364 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt365 := factory364.GetProtocol(mbTrans362)
		argvalue1 := types.NewNote()
		err366 := argvalue1.Read(jsProt365)
		if err366 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.CreateNote(value0, value1))
		fmt.Print("\n")
		break
	case "updateNote":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateNote requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg368 := flag.Arg(2)
		mbTrans369 := thrift.NewTMemoryBufferLen(len(arg368))
		defer mbTrans369.Close()
		_, err370 := mbTrans369.WriteString(arg368)
		if err370 != nil {
			Usage()
			return
		}
		factory371 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt372 := factory371.GetProtocol(mbTrans369)
		argvalue1 := types.NewNote()
		err373 := argvalue1.Read(jsProt372)
		if err373 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateNote(value0, value1))
		fmt.Print("\n")
		break
	case "deleteNote":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "DeleteNote requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.DeleteNote(value0, value1))
		fmt.Print("\n")
		break
	case "expungeNote":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ExpungeNote requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.ExpungeNote(value0, value1))
		fmt.Print("\n")
		break
	case "expungeNotes":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ExpungeNotes requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg379 := flag.Arg(2)
		mbTrans380 := thrift.NewTMemoryBufferLen(len(arg379))
		defer mbTrans380.Close()
		_, err381 := mbTrans380.WriteString(arg379)
		if err381 != nil {
			Usage()
			return
		}
		factory382 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt383 := factory382.GetProtocol(mbTrans380)
		containerStruct1 := notestore.NewNoteStoreExpungeNotesArgs()
		err384 := containerStruct1.ReadField2(jsProt383)
		if err384 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.NoteGuids
		value1 := argvalue1
		fmt.Print(client.ExpungeNotes(value0, value1))
		fmt.Print("\n")
		break
	case "expungeInactiveNotes":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ExpungeInactiveNotes requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.ExpungeInactiveNotes(value0))
		fmt.Print("\n")
		break
	case "copyNote":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "CopyNote requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := types.GUID(argvalue2)
		fmt.Print(client.CopyNote(value0, value1, value2))
		fmt.Print("\n")
		break
	case "listNoteVersions":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ListNoteVersions requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.ListNoteVersions(value0, value1))
		fmt.Print("\n")
		break
	case "getNoteVersion":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "GetNoteVersion requires 6 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		tmp2, err393 := (strconv.Atoi(flag.Arg(3)))
		if err393 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		argvalue4 := flag.Arg(5) == "true"
		value4 := argvalue4
		argvalue5 := flag.Arg(6) == "true"
		value5 := argvalue5
		fmt.Print(client.GetNoteVersion(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "getResource":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "GetResource requires 6 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		argvalue2 := flag.Arg(3) == "true"
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		argvalue4 := flag.Arg(5) == "true"
		value4 := argvalue4
		argvalue5 := flag.Arg(6) == "true"
		value5 := argvalue5
		fmt.Print(client.GetResource(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "getResourceApplicationData":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetResourceApplicationData requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.GetResourceApplicationData(value0, value1))
		fmt.Print("\n")
		break
	case "getResourceApplicationDataEntry":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "GetResourceApplicationDataEntry requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.GetResourceApplicationDataEntry(value0, value1, value2))
		fmt.Print("\n")
		break
	case "setResourceApplicationDataEntry":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "SetResourceApplicationDataEntry requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		fmt.Print(client.SetResourceApplicationDataEntry(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "unsetResourceApplicationDataEntry":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "UnsetResourceApplicationDataEntry requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.UnsetResourceApplicationDataEntry(value0, value1, value2))
		fmt.Print("\n")
		break
	case "updateResource":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateResource requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg416 := flag.Arg(2)
		mbTrans417 := thrift.NewTMemoryBufferLen(len(arg416))
		defer mbTrans417.Close()
		_, err418 := mbTrans417.WriteString(arg416)
		if err418 != nil {
			Usage()
			return
		}
		factory419 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt420 := factory419.GetProtocol(mbTrans417)
		argvalue1 := types.NewResource()
		err421 := argvalue1.Read(jsProt420)
		if err421 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateResource(value0, value1))
		fmt.Print("\n")
		break
	case "getResourceData":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetResourceData requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.GetResourceData(value0, value1))
		fmt.Print("\n")
		break
	case "getResourceByHash":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "GetResourceByHash requires 6 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		argvalue2 := []byte(flag.Arg(3))
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		argvalue4 := flag.Arg(5) == "true"
		value4 := argvalue4
		argvalue5 := flag.Arg(6) == "true"
		value5 := argvalue5
		fmt.Print(client.GetResourceByHash(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "getResourceRecognition":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetResourceRecognition requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.GetResourceRecognition(value0, value1))
		fmt.Print("\n")
		break
	case "getResourceAlternateData":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetResourceAlternateData requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.GetResourceAlternateData(value0, value1))
		fmt.Print("\n")
		break
	case "getResourceAttributes":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetResourceAttributes requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.GetResourceAttributes(value0, value1))
		fmt.Print("\n")
		break
	case "getPublicNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetPublicNotebook requires 2 args")
			flag.Usage()
		}
		tmp0, err436 := (strconv.Atoi(flag.Arg(1)))
		if err436 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := types.UserID(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.GetPublicNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "createSharedNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CreateSharedNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg439 := flag.Arg(2)
		mbTrans440 := thrift.NewTMemoryBufferLen(len(arg439))
		defer mbTrans440.Close()
		_, err441 := mbTrans440.WriteString(arg439)
		if err441 != nil {
			Usage()
			return
		}
		factory442 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt443 := factory442.GetProtocol(mbTrans440)
		argvalue1 := types.NewSharedNotebook()
		err444 := argvalue1.Read(jsProt443)
		if err444 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.CreateSharedNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "updateSharedNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateSharedNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg446 := flag.Arg(2)
		mbTrans447 := thrift.NewTMemoryBufferLen(len(arg446))
		defer mbTrans447.Close()
		_, err448 := mbTrans447.WriteString(arg446)
		if err448 != nil {
			Usage()
			return
		}
		factory449 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt450 := factory449.GetProtocol(mbTrans447)
		argvalue1 := types.NewSharedNotebook()
		err451 := argvalue1.Read(jsProt450)
		if err451 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateSharedNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "setSharedNotebookRecipientSettings":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "SetSharedNotebookRecipientSettings requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1, err453 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err453 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg454 := flag.Arg(3)
		mbTrans455 := thrift.NewTMemoryBufferLen(len(arg454))
		defer mbTrans455.Close()
		_, err456 := mbTrans455.WriteString(arg454)
		if err456 != nil {
			Usage()
			return
		}
		factory457 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt458 := factory457.GetProtocol(mbTrans455)
		argvalue2 := types.NewSharedNotebookRecipientSettings()
		err459 := argvalue2.Read(jsProt458)
		if err459 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.SetSharedNotebookRecipientSettings(value0, value1, value2))
		fmt.Print("\n")
		break
	case "sendMessageToSharedNotebookMembers":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "SendMessageToSharedNotebookMembers requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		arg463 := flag.Arg(4)
		mbTrans464 := thrift.NewTMemoryBufferLen(len(arg463))
		defer mbTrans464.Close()
		_, err465 := mbTrans464.WriteString(arg463)
		if err465 != nil {
			Usage()
			return
		}
		factory466 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt467 := factory466.GetProtocol(mbTrans464)
		containerStruct3 := notestore.NewNoteStoreSendMessageToSharedNotebookMembersArgs()
		err468 := containerStruct3.ReadField4(jsProt467)
		if err468 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Recipients
		value3 := argvalue3
		fmt.Print(client.SendMessageToSharedNotebookMembers(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "listSharedNotebooks":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ListSharedNotebooks requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.ListSharedNotebooks(value0))
		fmt.Print("\n")
		break
	case "expungeSharedNotebooks":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ExpungeSharedNotebooks requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg471 := flag.Arg(2)
		mbTrans472 := thrift.NewTMemoryBufferLen(len(arg471))
		defer mbTrans472.Close()
		_, err473 := mbTrans472.WriteString(arg471)
		if err473 != nil {
			Usage()
			return
		}
		factory474 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt475 := factory474.GetProtocol(mbTrans472)
		containerStruct1 := notestore.NewNoteStoreExpungeSharedNotebooksArgs()
		err476 := containerStruct1.ReadField2(jsProt475)
		if err476 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.SharedNotebookIds
		value1 := argvalue1
		fmt.Print(client.ExpungeSharedNotebooks(value0, value1))
		fmt.Print("\n")
		break
	case "createLinkedNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CreateLinkedNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg478 := flag.Arg(2)
		mbTrans479 := thrift.NewTMemoryBufferLen(len(arg478))
		defer mbTrans479.Close()
		_, err480 := mbTrans479.WriteString(arg478)
		if err480 != nil {
			Usage()
			return
		}
		factory481 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt482 := factory481.GetProtocol(mbTrans479)
		argvalue1 := types.NewLinkedNotebook()
		err483 := argvalue1.Read(jsProt482)
		if err483 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.CreateLinkedNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "updateLinkedNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateLinkedNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg485 := flag.Arg(2)
		mbTrans486 := thrift.NewTMemoryBufferLen(len(arg485))
		defer mbTrans486.Close()
		_, err487 := mbTrans486.WriteString(arg485)
		if err487 != nil {
			Usage()
			return
		}
		factory488 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt489 := factory488.GetProtocol(mbTrans486)
		argvalue1 := types.NewLinkedNotebook()
		err490 := argvalue1.Read(jsProt489)
		if err490 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateLinkedNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "listLinkedNotebooks":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ListLinkedNotebooks requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.ListLinkedNotebooks(value0))
		fmt.Print("\n")
		break
	case "expungeLinkedNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ExpungeLinkedNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.ExpungeLinkedNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "authenticateToSharedNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "AuthenticateToSharedNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.AuthenticateToSharedNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "getSharedNotebookByAuth":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetSharedNotebookByAuth requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetSharedNotebookByAuth(value0))
		fmt.Print("\n")
		break
	case "emailNote":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "EmailNote requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg498 := flag.Arg(2)
		mbTrans499 := thrift.NewTMemoryBufferLen(len(arg498))
		defer mbTrans499.Close()
		_, err500 := mbTrans499.WriteString(arg498)
		if err500 != nil {
			Usage()
			return
		}
		factory501 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt502 := factory501.GetProtocol(mbTrans499)
		argvalue1 := notestore.NewNoteEmailParameters()
		err503 := argvalue1.Read(jsProt502)
		if err503 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.EmailNote(value0, value1))
		fmt.Print("\n")
		break
	case "shareNote":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ShareNote requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.ShareNote(value0, value1))
		fmt.Print("\n")
		break
	case "stopSharingNote":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "StopSharingNote requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := types.GUID(argvalue1)
		fmt.Print(client.StopSharingNote(value0, value1))
		fmt.Print("\n")
		break
	case "authenticateToSharedNote":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "AuthenticateToSharedNote requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.AuthenticateToSharedNote(value0, value1, value2))
		fmt.Print("\n")
		break
	case "findRelated":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "FindRelated requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg512 := flag.Arg(2)
		mbTrans513 := thrift.NewTMemoryBufferLen(len(arg512))
		defer mbTrans513.Close()
		_, err514 := mbTrans513.WriteString(arg512)
		if err514 != nil {
			Usage()
			return
		}
		factory515 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt516 := factory515.GetProtocol(mbTrans513)
		argvalue1 := notestore.NewRelatedQuery()
		err517 := argvalue1.Read(jsProt516)
		if err517 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg518 := flag.Arg(3)
		mbTrans519 := thrift.NewTMemoryBufferLen(len(arg518))
		defer mbTrans519.Close()
		_, err520 := mbTrans519.WriteString(arg518)
		if err520 != nil {
			Usage()
			return
		}
		factory521 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt522 := factory521.GetProtocol(mbTrans519)
		argvalue2 := notestore.NewRelatedResultSpec()
		err523 := argvalue2.Read(jsProt522)
		if err523 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.FindRelated(value0, value1, value2))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 7
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := services.NewCitySvcClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "createCity":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "CreateCity requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg191 := flag.Arg(3)
		mbTrans192 := thrift.NewTMemoryBufferLen(len(arg191))
		defer mbTrans192.Close()
		_, err193 := mbTrans192.WriteString(arg191)
		if err193 != nil {
			Usage()
			return
		}
		factory194 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt195 := factory194.GetProtocol(mbTrans192)
		containerStruct2 := services.NewCitySvcCreateCityArgs()
		err196 := containerStruct2.ReadField3(jsProt195)
		if err196 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Coords
		value2 := argvalue2
		fmt.Print(client.CreateCity(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getNearBy":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetNearBy requires 2 args")
			flag.Usage()
		}
		arg197 := flag.Arg(1)
		mbTrans198 := thrift.NewTMemoryBufferLen(len(arg197))
		defer mbTrans198.Close()
		_, err199 := mbTrans198.WriteString(arg197)
		if err199 != nil {
			Usage()
			return
		}
		factory200 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt201 := factory200.GetProtocol(mbTrans198)
		argvalue0 := services.NewCoordinate()
		err202 := argvalue0.Read(jsProt201)
		if err202 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err203 := (strconv.Atoi(flag.Arg(2)))
		if err203 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		fmt.Print(client.GetNearBy(value0, value1))
		fmt.Print("\n")
		break
	case "getAllCities":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "GetAllCities requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.GetAllCities())
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = math.MinInt32 // will become unneeded eventually
	_ = strconv.Atoi
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := UserStore.NewUserStoreClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "checkVersion":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "CheckVersion requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err52 := (strconv.Atoi(flag.Arg(2)))
		if err52 != nil {
			Usage()
			return
		}
		argvalue1 := byte(tmp1)
		value1 := argvalue1
		tmp2, err53 := (strconv.Atoi(flag.Arg(3)))
		if err53 != nil {
			Usage()
			return
		}
		argvalue2 := byte(tmp2)
		value2 := argvalue2
		fmt.Print(client.CheckVersion(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getBootstrapInfo":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetBootstrapInfo requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetBootstrapInfo(value0))
		fmt.Print("\n")
		break
	case "authenticate":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "Authenticate requires 5 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		argvalue4 := flag.Arg(5) == "true"
		value4 := argvalue4
		fmt.Print(client.Authenticate(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "authenticateLongSession":
		if flag.NArg()-1 != 7 {
			fmt.Fprintln(os.Stderr, "AuthenticateLongSession requires 7 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		argvalue4 := flag.Arg(5)
		value4 := argvalue4
		argvalue5 := flag.Arg(6)
		value5 := argvalue5
		argvalue6 := flag.Arg(7) == "true"
		value6 := argvalue6
		fmt.Print(client.AuthenticateLongSession(value0, value1, value2, value3, value4, value5, value6))
		fmt.Print("\n")
		break
	case "completeTwoFactorAuthentication":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "CompleteTwoFactorAuthentication requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		fmt.Print(client.CompleteTwoFactorAuthentication(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "revokeLongSession":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "RevokeLongSession requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.RevokeLongSession(value0))
		fmt.Print("\n")
		break
	case "authenticateToBusiness":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "AuthenticateToBusiness requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.AuthenticateToBusiness(value0))
		fmt.Print("\n")
		break
	case "refreshAuthentication":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "RefreshAuthentication requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.RefreshAuthentication(value0))
		fmt.Print("\n")
		break
	case "getUser":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetUser requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetUser(value0))
		fmt.Print("\n")
		break
	case "getPublicUserInfo":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetPublicUserInfo requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetPublicUserInfo(value0))
		fmt.Print("\n")
		break
	case "getPremiumInfo":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetPremiumInfo requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetPremiumInfo(value0))
		fmt.Print("\n")
		break
	case "getNoteStoreUrl":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetNoteStoreUrl requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetNoteStoreUrl(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 9
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := servicessync.NewAccessManagerSyncClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "grantUserAccessToGroupRegion":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "GrantUserAccessToGroupRegion requires 6 args")
			flag.Usage()
		}
		argvalue0, err182 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err182 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err183 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err183 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg184 := flag.Arg(3)
		mbTrans185 := thrift.NewTMemoryBufferLen(len(arg184))
		defer mbTrans185.Close()
		_, err186 := mbTrans185.WriteString(arg184)
		if err186 != nil {
			Usage()
			return
		}
		factory187 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt188 := factory187.GetProtocol(mbTrans185)
		containerStruct2 := servicessync.NewGrantUserAccessToGroupRegionArgs()
		err189 := containerStruct2.ReadField3(jsProt188)
		if err189 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Zones
		value2 := argvalue2
		tmp3, err190 := (strconv.Atoi(flag.Arg(4)))
		if err190 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		tmp4, err191 := (strconv.Atoi(flag.Arg(5)))
		if err191 != nil {
			Usage()
			return
		}
		argvalue4 := int32(tmp4)
		value4 := argvalue4
		argvalue5, err192 := (strconv.ParseInt(flag.Arg(6), 10, 64))
		if err192 != nil {
			Usage()
			return
		}
		value5 := argvalue5
		fmt.Print(client.GrantUserAccessToGroupRegion(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "hasAccessToRegion":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "HasAccessToRegion requires 3 args")
			flag.Usage()
		}
		argvalue0, err193 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err193 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err194 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err194 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := servicessync.Zone(tmp2)
		value2 := argvalue2
		fmt.Print(client.HasAccessToRegion(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getAccessableGroupResources":
		if flag.NArg()-1 != 9 {
			fmt.Fprintln(os.Stderr, "GetAccessableGroupResources requires 9 args")
			flag.Usage()
		}
		argvalue0, err195 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err195 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err196 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err196 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := servicessync.Zone(tmp2)
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := servicessync.ResourceType(tmp3)
		value3 := argvalue3
		argvalue4, err197 := (strconv.ParseInt(flag.Arg(5), 10, 64))
		if err197 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		argvalue5, err198 := (strconv.ParseInt(flag.Arg(6), 10, 64))
		if err198 != nil {
			Usage()
			return
		}
		value5 := argvalue5
		argvalue6, err199 := (strconv.ParseInt(flag.Arg(7), 10, 64))
		if err199 != nil {
			Usage()
			return
		}
		value6 := argvalue6
		argvalue7 := flag.Arg(8) == "true"
		value7 := argvalue7
		tmp8, err201 := (strconv.Atoi(flag.Arg(9)))
		if err201 != nil {
			Usage()
			return
		}
		argvalue8 := int32(tmp8)
		value8 := argvalue8
		fmt.Print(client.GetAccessableGroupResources(value0, value1, value2, value3, value4, value5, value6, value7, value8))
		fmt.Print("\n")
		break
	case "getAccessZoneUsers":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetAccessZoneUsers requires 4 args")
			flag.Usage()
		}
		argvalue0, err202 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err202 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := servicessync.Zone(tmp1)
		value1 := argvalue1
		argvalue2, err203 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err203 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		tmp3, err204 := (strconv.Atoi(flag.Arg(4)))
		if err204 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		fmt.Print(client.GetAccessZoneUsers(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getUserAccessZones":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetUserAccessZones requires 2 args")
			flag.Usage()
		}
		argvalue0, err205 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err205 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err206 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err206 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.GetUserAccessZones(value0, value1))
		fmt.Print("\n")
		break
	case "moveZone":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "MoveZone requires 5 args")
			flag.Usage()
		}
		argvalue0, err207 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err207 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg208 := flag.Arg(2)
		mbTrans209 := thrift.NewTMemoryBufferLen(len(arg208))
		defer mbTrans209.Close()
		_, err210 := mbTrans209.WriteString(arg208)
		if err210 != nil {
			Usage()
			return
		}
		factory211 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt212 := factory211.GetProtocol(mbTrans209)
		containerStruct1 := servicessync.NewMoveZoneArgs()
		err213 := containerStruct1.ReadField2(jsProt212)
		if err213 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Uids
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := servicessync.Zone(tmp2)
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := servicessync.Zone(tmp3)
		value3 := argvalue3
		argvalue4, err214 := (strconv.ParseInt(flag.Arg(5), 10, 64))
		if err214 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		fmt.Print(client.MoveZone(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := demo.NewIdoallThriftClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "CallBack":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "CallBack requires 3 args")
			flag.Usage()
		}
		argvalue0, err9 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err9 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg11 := flag.Arg(3)
		mbTrans12 := thrift.NewTMemoryBufferLen(len(arg11))
		defer mbTrans12.Close()
		_, err13 := mbTrans12.WriteString(arg11)
		if err13 != nil {
			Usage()
			return
		}
		factory14 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt15 := factory14.GetProtocol(mbTrans12)
		containerStruct2 := demo.NewCallBackArgs()
		err16 := containerStruct2.ReadField3(jsProt15)
		if err16 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.ParamMap
		value2 := argvalue2
		fmt.Print(client.CallBack(value0, value1, value2))
		fmt.Print("\n")
		break
	case "put":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "Put requires 1 args")
			flag.Usage()
		}
		arg17 := flag.Arg(1)
		mbTrans18 := thrift.NewTMemoryBufferLen(len(arg17))
		defer mbTrans18.Close()
		_, err19 := mbTrans18.WriteString(arg17)
		if err19 != nil {
			Usage()
			return
		}
		factory20 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt21 := factory20.GetProtocol(mbTrans18)
		argvalue0 := demo.NewStudent()
		err22 := argvalue0.Read(jsProt21)
		if err22 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.Put(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 11
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := services.NewTagManagerClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "addTag":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "AddTag requires 5 args")
			flag.Usage()
		}
		argvalue0, err1486 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err1486 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err1487 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err1487 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := services.ResourceType(tmp2)
		value2 := argvalue2
		arg1488 := flag.Arg(4)
		mbTrans1489 := thrift.NewTMemoryBufferLen(len(arg1488))
		defer mbTrans1489.Close()
		_, err1490 := mbTrans1489.WriteString(arg1488)
		if err1490 != nil {
			Usage()
			return
		}
		factory1491 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1492 := factory1491.GetProtocol(mbTrans1489)
		containerStruct3 := services.NewAddTagArgs()
		err1493 := containerStruct3.ReadField4(jsProt1492)
		if err1493 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Tags
		value3 := argvalue3
		arg1494 := flag.Arg(5)
		mbTrans1495 := thrift.NewTMemoryBufferLen(len(arg1494))
		defer mbTrans1495.Close()
		_, err1496 := mbTrans1495.WriteString(arg1494)
		if err1496 != nil {
			Usage()
			return
		}
		factory1497 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1498 := factory1497.GetProtocol(mbTrans1495)
		argvalue4 := services.NewFromInfo()
		err1499 := argvalue4.Read(jsProt1498)
		if err1499 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		fmt.Print(client.AddTag(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "getTags":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "GetTags requires 3 args")
			flag.Usage()
		}
		argvalue0, err1500 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err1500 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err1501 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err1501 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg1502 := flag.Arg(3)
		mbTrans1503 := thrift.NewTMemoryBufferLen(len(arg1502))
		defer mbTrans1503.Close()
		_, err1504 := mbTrans1503.WriteString(arg1502)
		if err1504 != nil {
			Usage()
			return
		}
		factory1505 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1506 := factory1505.GetProtocol(mbTrans1503)
		argvalue2 := services.NewFromInfo()
		err1507 := argvalue2.Read(jsProt1506)
		if err1507 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.GetTags(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getTagsByUid":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetTagsByUid requires 4 args")
			flag.Usage()
		}
		argvalue0, err1508 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err1508 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err1509 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err1509 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err1510 := (strconv.Atoi(flag.Arg(3)))
		if err1510 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		arg1511 := flag.Arg(4)
		mbTrans1512 := thrift.NewTMemoryBufferLen(len(arg1511))
		defer mbTrans1512.Close()
		_, err1513 := mbTrans1512.WriteString(arg1511)
		if err1513 != nil {
			Usage()
			return
		}
		factory1514 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1515 := factory1514.GetProtocol(mbTrans1512)
		argvalue3 := services.NewFromInfo()
		err1516 := argvalue3.Read(jsProt1515)
		if err1516 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.GetTagsByUid(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "updateTags":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "UpdateTags requires 5 args")
			flag.Usage()
		}
		argvalue0, err1517 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err1517 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err1518 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err1518 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := services.ResourceType(tmp2)
		value2 := argvalue2
		arg1519 := flag.Arg(4)
		mbTrans1520 := thrift.NewTMemoryBufferLen(len(arg1519))
		defer mbTrans1520.Close()
		_, err1521 := mbTrans1520.WriteString(arg1519)
		if err1521 != nil {
			Usage()
			return
		}
		factory1522 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1523 := factory1522.GetProtocol(mbTrans1520)
		containerStruct3 := services.NewUpdateTagsArgs()
		err1524 := containerStruct3.ReadField4(jsProt1523)
		if err1524 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Tags
		value3 := argvalue3
		arg1525 := flag.Arg(5)
		mbTrans1526 := thrift.NewTMemoryBufferLen(len(arg1525))
		defer mbTrans1526.Close()
		_, err1527 := mbTrans1526.WriteString(arg1525)
		if err1527 != nil {
			Usage()
			return
		}
		factory1528 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1529 := factory1528.GetProtocol(mbTrans1526)
		argvalue4 := services.NewFromInfo()
		err1530 := argvalue4.Read(jsProt1529)
		if err1530 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		fmt.Print(client.UpdateTags(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 12
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := services.NewUserManagerClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "createUser":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "CreateUser requires 1 args")
			flag.Usage()
		}
		arg513 := flag.Arg(1)
		mbTrans514 := thrift.NewTMemoryBufferLen(len(arg513))
		defer mbTrans514.Close()
		_, err515 := mbTrans514.WriteString(arg513)
		if err515 != nil {
			Usage()
			return
		}
		factory516 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt517 := factory516.GetProtocol(mbTrans514)
		argvalue0 := services.NewUser()
		err518 := argvalue0.Read(jsProt517)
		if err518 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.CreateUser(value0))
		fmt.Print("\n")
		break
	case "updateUser":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "UpdateUser requires 3 args")
			flag.Usage()
		}
		arg519 := flag.Arg(1)
		mbTrans520 := thrift.NewTMemoryBufferLen(len(arg519))
		defer mbTrans520.Close()
		_, err521 := mbTrans520.WriteString(arg519)
		if err521 != nil {
			Usage()
			return
		}
		factory522 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt523 := factory522.GetProtocol(mbTrans520)
		argvalue0 := services.NewUser()
		err524 := argvalue0.Read(jsProt523)
		if err524 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err525 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err525 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg526 := flag.Arg(3)
		mbTrans527 := thrift.NewTMemoryBufferLen(len(arg526))
		defer mbTrans527.Close()
		_, err528 := mbTrans527.WriteString(arg526)
		if err528 != nil {
			Usage()
			return
		}
		factory529 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt530 := factory529.GetProtocol(mbTrans527)
		argvalue2 := services.NewFromInfo()
		err531 := argvalue2.Read(jsProt530)
		if err531 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.UpdateUser(value0, value1, value2))
		fmt.Print("\n")
		break
	case "setLoginTime":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "SetLoginTime requires 3 args")
			flag.Usage()
		}
		argvalue0, err532 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err532 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg534 := flag.Arg(3)
		mbTrans535 := thrift.NewTMemoryBufferLen(len(arg534))
		defer mbTrans535.Close()
		_, err536 := mbTrans535.WriteString(arg534)
		if err536 != nil {
			Usage()
			return
		}
		factory537 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt538 := factory537.GetProtocol(mbTrans535)
		argvalue2 := services.NewFromInfo()
		err539 := argvalue2.Read(jsProt538)
		if err539 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.SetLoginTime(value0, value1, value2))
		fmt.Print("\n")
		break
	case "setLogoutTime":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "SetLogoutTime requires 3 args")
			flag.Usage()
		}
		argvalue0, err540 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err540 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg542 := flag.Arg(3)
		mbTrans543 := thrift.NewTMemoryBufferLen(len(arg542))
		defer mbTrans543.Close()
		_, err544 := mbTrans543.WriteString(arg542)
		if err544 != nil {
			Usage()
			return
		}
		factory545 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt546 := factory545.GetProtocol(mbTrans543)
		argvalue2 := services.NewFromInfo()
		err547 := argvalue2.Read(jsProt546)
		if err547 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.SetLogoutTime(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getUserById":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetUserById requires 2 args")
			flag.Usage()
		}
		argvalue0, err548 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err548 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg549 := flag.Arg(2)
		mbTrans550 := thrift.NewTMemoryBufferLen(len(arg549))
		defer mbTrans550.Close()
		_, err551 := mbTrans550.WriteString(arg549)
		if err551 != nil {
			Usage()
			return
		}
		factory552 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt553 := factory552.GetProtocol(mbTrans550)
		argvalue1 := services.NewFromInfo()
		err554 := argvalue1.Read(jsProt553)
		if err554 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.GetUserById(value0, value1))
		fmt.Print("\n")
		break
	case "getUserByEmail":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetUserByEmail requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg556 := flag.Arg(2)
		mbTrans557 := thrift.NewTMemoryBufferLen(len(arg556))
		defer mbTrans557.Close()
		_, err558 := mbTrans557.WriteString(arg556)
		if err558 != nil {
			Usage()
			return
		}
		factory559 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt560 := factory559.GetProtocol(mbTrans557)
		argvalue1 := services.NewFromInfo()
		err561 := argvalue1.Read(jsProt560)
		if err561 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.GetUserByEmail(value0, value1))
		fmt.Print("\n")
		break
	case "getUserByPhone":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetUserByPhone requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg563 := flag.Arg(2)
		mbTrans564 := thrift.NewTMemoryBufferLen(len(arg563))
		defer mbTrans564.Close()
		_, err565 := mbTrans564.WriteString(arg563)
		if err565 != nil {
			Usage()
			return
		}
		factory566 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt567 := factory566.GetProtocol(mbTrans564)
		argvalue1 := services.NewFromInfo()
		err568 := argvalue1.Read(jsProt567)
		if err568 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.GetUserByPhone(value0, value1))
		fmt.Print("\n")
		break
	case "inviteUserByPhone":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "InviteUserByPhone requires 3 args")
			flag.Usage()
		}
		argvalue0, err569 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err569 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg571 := flag.Arg(3)
		mbTrans572 := thrift.NewTMemoryBufferLen(len(arg571))
		defer mbTrans572.Close()
		_, err573 := mbTrans572.WriteString(arg571)
		if err573 != nil {
			Usage()
			return
		}
		factory574 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt575 := factory574.GetProtocol(mbTrans572)
		argvalue2 := services.NewFromInfo()
		err576 := argvalue2.Read(jsProt575)
		if err576 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.InviteUserByPhone(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getUsersByPhones":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetUsersByPhones requires 2 args")
			flag.Usage()
		}
		arg577 := flag.Arg(1)
		mbTrans578 := thrift.NewTMemoryBufferLen(len(arg577))
		defer mbTrans578.Close()
		_, err579 := mbTrans578.WriteString(arg577)
		if err579 != nil {
			Usage()
			return
		}
		factory580 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt581 := factory580.GetProtocol(mbTrans578)
		containerStruct0 := services.NewGetUsersByPhonesArgs()
		err582 := containerStruct0.ReadField1(jsProt581)
		if err582 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Phones
		value0 := argvalue0
		arg583 := flag.Arg(2)
		mbTrans584 := thrift.NewTMemoryBufferLen(len(arg583))
		defer mbTrans584.Close()
		_, err585 := mbTrans584.WriteString(arg583)
		if err585 != nil {
			Usage()
			return
		}
		factory586 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt587 := factory586.GetProtocol(mbTrans584)
		argvalue1 := services.NewFromInfo()
		err588 := argvalue1.Read(jsProt587)
		if err588 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.GetUsersByPhones(value0, value1))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = math.MinInt32 // will become unneeded eventually
	_ = strconv.Atoi
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := NoteStore.NewNoteStoreClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "getSyncState":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetSyncState requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetSyncState(value0))
		fmt.Print("\n")
		break
	case "getSyncStateWithMetrics":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetSyncStateWithMetrics requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg344 := flag.Arg(2)
		mbTrans345 := thrift.NewTMemoryBufferLen(len(arg344))
		defer mbTrans345.Close()
		_, err346 := mbTrans345.WriteString(arg344)
		if err346 != nil {
			Usage()
			return
		}
		factory347 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt348 := factory347.GetProtocol(mbTrans345)
		argvalue1 := NoteStore.NewClientUsageMetrics()
		err349 := argvalue1.Read(jsProt348)
		if err349 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.GetSyncStateWithMetrics(value0, value1))
		fmt.Print("\n")
		break
	case "getSyncChunk":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetSyncChunk requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err351 := (strconv.Atoi(flag.Arg(2)))
		if err351 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		tmp2, err352 := (strconv.Atoi(flag.Arg(3)))
		if err352 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		fmt.Print(client.GetSyncChunk(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getFilteredSyncChunk":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetFilteredSyncChunk requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err355 := (strconv.Atoi(flag.Arg(2)))
		if err355 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		tmp2, err356 := (strconv.Atoi(flag.Arg(3)))
		if err356 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		arg357 := flag.Arg(4)
		mbTrans358 := thrift.NewTMemoryBufferLen(len(arg357))
		defer mbTrans358.Close()
		_, err359 := mbTrans358.WriteString(arg357)
		if err359 != nil {
			Usage()
			return
		}
		factory360 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt361 := factory360.GetProtocol(mbTrans358)
		argvalue3 := NoteStore.NewSyncChunkFilter()
		err362 := argvalue3.Read(jsProt361)
		if err362 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.GetFilteredSyncChunk(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getLinkedNotebookSyncState":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetLinkedNotebookSyncState requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg364 := flag.Arg(2)
		mbTrans365 := thrift.NewTMemoryBufferLen(len(arg364))
		defer mbTrans365.Close()
		_, err366 := mbTrans365.WriteString(arg364)
		if err366 != nil {
			Usage()
			return
		}
		factory367 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt368 := factory367.GetProtocol(mbTrans365)
		argvalue1 := NoteStore.NewLinkedNotebook()
		err369 := argvalue1.Read(jsProt368)
		if err369 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.GetLinkedNotebookSyncState(value0, value1))
		fmt.Print("\n")
		break
	case "getLinkedNotebookSyncChunk":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "GetLinkedNotebookSyncChunk requires 5 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg371 := flag.Arg(2)
		mbTrans372 := thrift.NewTMemoryBufferLen(len(arg371))
		defer mbTrans372.Close()
		_, err373 := mbTrans372.WriteString(arg371)
		if err373 != nil {
			Usage()
			return
		}
		factory374 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt375 := factory374.GetProtocol(mbTrans372)
		argvalue1 := NoteStore.NewLinkedNotebook()
		err376 := argvalue1.Read(jsProt375)
		if err376 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err377 := (strconv.Atoi(flag.Arg(3)))
		if err377 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		tmp3, err378 := (strconv.Atoi(flag.Arg(4)))
		if err378 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		argvalue4 := flag.Arg(5) == "true"
		value4 := argvalue4
		fmt.Print(client.GetLinkedNotebookSyncChunk(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "listNotebooks":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ListNotebooks requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.ListNotebooks(value0))
		fmt.Print("\n")
		break
	case "getNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.GetNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "getDefaultNotebook":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetDefaultNotebook requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetDefaultNotebook(value0))
		fmt.Print("\n")
		break
	case "createNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CreateNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg385 := flag.Arg(2)
		mbTrans386 := thrift.NewTMemoryBufferLen(len(arg385))
		defer mbTrans386.Close()
		_, err387 := mbTrans386.WriteString(arg385)
		if err387 != nil {
			Usage()
			return
		}
		factory388 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt389 := factory388.GetProtocol(mbTrans386)
		argvalue1 := NoteStore.NewNotebook()
		err390 := argvalue1.Read(jsProt389)
		if err390 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.CreateNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "updateNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg392 := flag.Arg(2)
		mbTrans393 := thrift.NewTMemoryBufferLen(len(arg392))
		defer mbTrans393.Close()
		_, err394 := mbTrans393.WriteString(arg392)
		if err394 != nil {
			Usage()
			return
		}
		factory395 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt396 := factory395.GetProtocol(mbTrans393)
		argvalue1 := NoteStore.NewNotebook()
		err397 := argvalue1.Read(jsProt396)
		if err397 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "expungeNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ExpungeNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.ExpungeNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "listTags":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ListTags requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.ListTags(value0))
		fmt.Print("\n")
		break
	case "listTagsByNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ListTagsByNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.ListTagsByNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "getTag":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetTag requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.GetTag(value0, value1))
		fmt.Print("\n")
		break
	case "createTag":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CreateTag requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg406 := flag.Arg(2)
		mbTrans407 := thrift.NewTMemoryBufferLen(len(arg406))
		defer mbTrans407.Close()
		_, err408 := mbTrans407.WriteString(arg406)
		if err408 != nil {
			Usage()
			return
		}
		factory409 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt410 := factory409.GetProtocol(mbTrans407)
		argvalue1 := NoteStore.NewTag()
		err411 := argvalue1.Read(jsProt410)
		if err411 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.CreateTag(value0, value1))
		fmt.Print("\n")
		break
	case "updateTag":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateTag requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg413 := flag.Arg(2)
		mbTrans414 := thrift.NewTMemoryBufferLen(len(arg413))
		defer mbTrans414.Close()
		_, err415 := mbTrans414.WriteString(arg413)
		if err415 != nil {
			Usage()
			return
		}
		factory416 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt417 := factory416.GetProtocol(mbTrans414)
		argvalue1 := NoteStore.NewTag()
		err418 := argvalue1.Read(jsProt417)
		if err418 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateTag(value0, value1))
		fmt.Print("\n")
		break
	case "untagAll":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UntagAll requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.UntagAll(value0, value1))
		fmt.Print("\n")
		break
	case "expungeTag":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ExpungeTag requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.ExpungeTag(value0, value1))
		fmt.Print("\n")
		break
	case "listSearches":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ListSearches requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.ListSearches(value0))
		fmt.Print("\n")
		break
	case "getSearch":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetSearch requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.GetSearch(value0, value1))
		fmt.Print("\n")
		break
	case "createSearch":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CreateSearch requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg427 := flag.Arg(2)
		mbTrans428 := thrift.NewTMemoryBufferLen(len(arg427))
		defer mbTrans428.Close()
		_, err429 := mbTrans428.WriteString(arg427)
		if err429 != nil {
			Usage()
			return
		}
		factory430 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt431 := factory430.GetProtocol(mbTrans428)
		argvalue1 := NoteStore.NewSavedSearch()
		err432 := argvalue1.Read(jsProt431)
		if err432 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.CreateSearch(value0, value1))
		fmt.Print("\n")
		break
	case "updateSearch":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateSearch requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg434 := flag.Arg(2)
		mbTrans435 := thrift.NewTMemoryBufferLen(len(arg434))
		defer mbTrans435.Close()
		_, err436 := mbTrans435.WriteString(arg434)
		if err436 != nil {
			Usage()
			return
		}
		factory437 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt438 := factory437.GetProtocol(mbTrans435)
		argvalue1 := NoteStore.NewSavedSearch()
		err439 := argvalue1.Read(jsProt438)
		if err439 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateSearch(value0, value1))
		fmt.Print("\n")
		break
	case "expungeSearch":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ExpungeSearch requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.ExpungeSearch(value0, value1))
		fmt.Print("\n")
		break
	case "findNotes":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "FindNotes requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg443 := flag.Arg(2)
		mbTrans444 := thrift.NewTMemoryBufferLen(len(arg443))
		defer mbTrans444.Close()
		_, err445 := mbTrans444.WriteString(arg443)
		if err445 != nil {
			Usage()
			return
		}
		factory446 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt447 := factory446.GetProtocol(mbTrans444)
		argvalue1 := NoteStore.NewNoteFilter()
		err448 := argvalue1.Read(jsProt447)
		if err448 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err449 := (strconv.Atoi(flag.Arg(3)))
		if err449 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		tmp3, err450 := (strconv.Atoi(flag.Arg(4)))
		if err450 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		fmt.Print(client.FindNotes(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "findNoteOffset":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "FindNoteOffset requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg452 := flag.Arg(2)
		mbTrans453 := thrift.NewTMemoryBufferLen(len(arg452))
		defer mbTrans453.Close()
		_, err454 := mbTrans453.WriteString(arg452)
		if err454 != nil {
			Usage()
			return
		}
		factory455 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt456 := factory455.GetProtocol(mbTrans453)
		argvalue1 := NoteStore.NewNoteFilter()
		err457 := argvalue1.Read(jsProt456)
		if err457 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := NoteStore.Guid(argvalue2)
		fmt.Print(client.FindNoteOffset(value0, value1, value2))
		fmt.Print("\n")
		break
	case "findNotesMetadata":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "FindNotesMetadata requires 5 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg460 := flag.Arg(2)
		mbTrans461 := thrift.NewTMemoryBufferLen(len(arg460))
		defer mbTrans461.Close()
		_, err462 := mbTrans461.WriteString(arg460)
		if err462 != nil {
			Usage()
			return
		}
		factory463 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt464 := factory463.GetProtocol(mbTrans461)
		argvalue1 := NoteStore.NewNoteFilter()
		err465 := argvalue1.Read(jsProt464)
		if err465 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err466 := (strconv.Atoi(flag.Arg(3)))
		if err466 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		tmp3, err467 := (strconv.Atoi(flag.Arg(4)))
		if err467 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		arg468 := flag.Arg(5)
		mbTrans469 := thrift.NewTMemoryBufferLen(len(arg468))
		defer mbTrans469.Close()
		_, err470 := mbTrans469.WriteString(arg468)
		if err470 != nil {
			Usage()
			return
		}
		factory471 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt472 := factory471.GetProtocol(mbTrans469)
		argvalue4 := NoteStore.NewNotesMetadataResultSpec()
		err473 := argvalue4.Read(jsProt472)
		if err473 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		fmt.Print(client.FindNotesMetadata(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "findNoteCounts":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "FindNoteCounts requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg475 := flag.Arg(2)
		mbTrans476 := thrift.NewTMemoryBufferLen(len(arg475))
		defer mbTrans476.Close()
		_, err477 := mbTrans476.WriteString(arg475)
		if err477 != nil {
			Usage()
			return
		}
		factory478 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt479 := factory478.GetProtocol(mbTrans476)
		argvalue1 := NoteStore.NewNoteFilter()
		err480 := argvalue1.Read(jsProt479)
		if err480 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2 := flag.Arg(3) == "true"
		value2 := argvalue2
		fmt.Print(client.FindNoteCounts(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getNote":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "GetNote requires 6 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		argvalue2 := flag.Arg(3) == "true"
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		argvalue4 := flag.Arg(5) == "true"
		value4 := argvalue4
		argvalue5 := flag.Arg(6) == "true"
		value5 := argvalue5
		fmt.Print(client.GetNote(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "getNoteApplicationData":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetNoteApplicationData requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.GetNoteApplicationData(value0, value1))
		fmt.Print("\n")
		break
	case "getNoteApplicationDataEntry":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "GetNoteApplicationDataEntry requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.GetNoteApplicationDataEntry(value0, value1, value2))
		fmt.Print("\n")
		break
	case "setNoteApplicationDataEntry":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "SetNoteApplicationDataEntry requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		fmt.Print(client.SetNoteApplicationDataEntry(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "unsetNoteApplicationDataEntry":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "UnsetNoteApplicationDataEntry requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.UnsetNoteApplicationDataEntry(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getNoteContent":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetNoteContent requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.GetNoteContent(value0, value1))
		fmt.Print("\n")
		break
	case "getNoteSearchText":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetNoteSearchText requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		argvalue2 := flag.Arg(3) == "true"
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		fmt.Print(client.GetNoteSearchText(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getResourceSearchText":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetResourceSearchText requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.GetResourceSearchText(value0, value1))
		fmt.Print("\n")
		break
	case "getNoteTagNames":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetNoteTagNames requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.GetNoteTagNames(value0, value1))
		fmt.Print("\n")
		break
	case "createNote":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CreateNote requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg511 := flag.Arg(2)
		mbTrans512 := thrift.NewTMemoryBufferLen(len(arg511))
		defer mbTrans512.Close()
		_, err513 := mbTrans512.WriteString(arg511)
		if err513 != nil {
			Usage()
			return
		}
		factory514 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt515 := factory514.GetProtocol(mbTrans512)
		argvalue1 := NoteStore.NewNote()
		err516 := argvalue1.Read(jsProt515)
		if err516 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.CreateNote(value0, value1))
		fmt.Print("\n")
		break
	case "updateNote":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateNote requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg518 := flag.Arg(2)
		mbTrans519 := thrift.NewTMemoryBufferLen(len(arg518))
		defer mbTrans519.Close()
		_, err520 := mbTrans519.WriteString(arg518)
		if err520 != nil {
			Usage()
			return
		}
		factory521 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt522 := factory521.GetProtocol(mbTrans519)
		argvalue1 := NoteStore.NewNote()
		err523 := argvalue1.Read(jsProt522)
		if err523 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateNote(value0, value1))
		fmt.Print("\n")
		break
	case "deleteNote":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "DeleteNote requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.DeleteNote(value0, value1))
		fmt.Print("\n")
		break
	case "expungeNote":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ExpungeNote requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.ExpungeNote(value0, value1))
		fmt.Print("\n")
		break
	case "expungeNotes":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ExpungeNotes requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg529 := flag.Arg(2)
		mbTrans530 := thrift.NewTMemoryBufferLen(len(arg529))
		defer mbTrans530.Close()
		_, err531 := mbTrans530.WriteString(arg529)
		if err531 != nil {
			Usage()
			return
		}
		factory532 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt533 := factory532.GetProtocol(mbTrans530)
		containerStruct1 := NoteStore.NewExpungeNotesArgs()
		err534 := containerStruct1.ReadField2(jsProt533)
		if err534 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.NoteGuids
		value1 := argvalue1
		fmt.Print(client.ExpungeNotes(value0, value1))
		fmt.Print("\n")
		break
	case "expungeInactiveNotes":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ExpungeInactiveNotes requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.ExpungeInactiveNotes(value0))
		fmt.Print("\n")
		break
	case "copyNote":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "CopyNote requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := NoteStore.Guid(argvalue2)
		fmt.Print(client.CopyNote(value0, value1, value2))
		fmt.Print("\n")
		break
	case "listNoteVersions":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ListNoteVersions requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.ListNoteVersions(value0, value1))
		fmt.Print("\n")
		break
	case "getNoteVersion":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "GetNoteVersion requires 6 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		tmp2, err543 := (strconv.Atoi(flag.Arg(3)))
		if err543 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		argvalue4 := flag.Arg(5) == "true"
		value4 := argvalue4
		argvalue5 := flag.Arg(6) == "true"
		value5 := argvalue5
		fmt.Print(client.GetNoteVersion(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "getResource":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "GetResource requires 6 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		argvalue2 := flag.Arg(3) == "true"
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		argvalue4 := flag.Arg(5) == "true"
		value4 := argvalue4
		argvalue5 := flag.Arg(6) == "true"
		value5 := argvalue5
		fmt.Print(client.GetResource(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "getResourceApplicationData":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetResourceApplicationData requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.GetResourceApplicationData(value0, value1))
		fmt.Print("\n")
		break
	case "getResourceApplicationDataEntry":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "GetResourceApplicationDataEntry requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.GetResourceApplicationDataEntry(value0, value1, value2))
		fmt.Print("\n")
		break
	case "setResourceApplicationDataEntry":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "SetResourceApplicationDataEntry requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		fmt.Print(client.SetResourceApplicationDataEntry(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "unsetResourceApplicationDataEntry":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "UnsetResourceApplicationDataEntry requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.UnsetResourceApplicationDataEntry(value0, value1, value2))
		fmt.Print("\n")
		break
	case "updateResource":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateResource requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg566 := flag.Arg(2)
		mbTrans567 := thrift.NewTMemoryBufferLen(len(arg566))
		defer mbTrans567.Close()
		_, err568 := mbTrans567.WriteString(arg566)
		if err568 != nil {
			Usage()
			return
		}
		factory569 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt570 := factory569.GetProtocol(mbTrans567)
		argvalue1 := NoteStore.NewResource()
		err571 := argvalue1.Read(jsProt570)
		if err571 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateResource(value0, value1))
		fmt.Print("\n")
		break
	case "getResourceData":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetResourceData requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.GetResourceData(value0, value1))
		fmt.Print("\n")
		break
	case "getResourceByHash":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "GetResourceByHash requires 6 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		argvalue4 := flag.Arg(5) == "true"
		value4 := argvalue4
		argvalue5 := flag.Arg(6) == "true"
		value5 := argvalue5
		fmt.Print(client.GetResourceByHash(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "getResourceRecognition":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetResourceRecognition requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.GetResourceRecognition(value0, value1))
		fmt.Print("\n")
		break
	case "getResourceAlternateData":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetResourceAlternateData requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.GetResourceAlternateData(value0, value1))
		fmt.Print("\n")
		break
	case "getResourceAttributes":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetResourceAttributes requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.GetResourceAttributes(value0, value1))
		fmt.Print("\n")
		break
	case "getPublicNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetPublicNotebook requires 2 args")
			flag.Usage()
		}
		tmp0, err586 := (strconv.Atoi(flag.Arg(1)))
		if err586 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := NoteStore.UserID(argvalue0)
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.GetPublicNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "createSharedNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CreateSharedNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg589 := flag.Arg(2)
		mbTrans590 := thrift.NewTMemoryBufferLen(len(arg589))
		defer mbTrans590.Close()
		_, err591 := mbTrans590.WriteString(arg589)
		if err591 != nil {
			Usage()
			return
		}
		factory592 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt593 := factory592.GetProtocol(mbTrans590)
		argvalue1 := NoteStore.NewSharedNotebook()
		err594 := argvalue1.Read(jsProt593)
		if err594 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.CreateSharedNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "updateSharedNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateSharedNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg596 := flag.Arg(2)
		mbTrans597 := thrift.NewTMemoryBufferLen(len(arg596))
		defer mbTrans597.Close()
		_, err598 := mbTrans597.WriteString(arg596)
		if err598 != nil {
			Usage()
			return
		}
		factory599 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt600 := factory599.GetProtocol(mbTrans597)
		argvalue1 := NoteStore.NewSharedNotebook()
		err601 := argvalue1.Read(jsProt600)
		if err601 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateSharedNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "setSharedNotebookRecipientSettings":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "SetSharedNotebookRecipientSettings requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1, err603 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err603 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg604 := flag.Arg(3)
		mbTrans605 := thrift.NewTMemoryBufferLen(len(arg604))
		defer mbTrans605.Close()
		_, err606 := mbTrans605.WriteString(arg604)
		if err606 != nil {
			Usage()
			return
		}
		factory607 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt608 := factory607.GetProtocol(mbTrans605)
		argvalue2 := NoteStore.NewSharedNotebookRecipientSettings()
		err609 := argvalue2.Read(jsProt608)
		if err609 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.SetSharedNotebookRecipientSettings(value0, value1, value2))
		fmt.Print("\n")
		break
	case "sendMessageToSharedNotebookMembers":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "SendMessageToSharedNotebookMembers requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		arg613 := flag.Arg(4)
		mbTrans614 := thrift.NewTMemoryBufferLen(len(arg613))
		defer mbTrans614.Close()
		_, err615 := mbTrans614.WriteString(arg613)
		if err615 != nil {
			Usage()
			return
		}
		factory616 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt617 := factory616.GetProtocol(mbTrans614)
		containerStruct3 := NoteStore.NewSendMessageToSharedNotebookMembersArgs()
		err618 := containerStruct3.ReadField4(jsProt617)
		if err618 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Recipients
		value3 := argvalue3
		fmt.Print(client.SendMessageToSharedNotebookMembers(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "listSharedNotebooks":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ListSharedNotebooks requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.ListSharedNotebooks(value0))
		fmt.Print("\n")
		break
	case "expungeSharedNotebooks":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ExpungeSharedNotebooks requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg621 := flag.Arg(2)
		mbTrans622 := thrift.NewTMemoryBufferLen(len(arg621))
		defer mbTrans622.Close()
		_, err623 := mbTrans622.WriteString(arg621)
		if err623 != nil {
			Usage()
			return
		}
		factory624 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt625 := factory624.GetProtocol(mbTrans622)
		containerStruct1 := NoteStore.NewExpungeSharedNotebooksArgs()
		err626 := containerStruct1.ReadField2(jsProt625)
		if err626 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.SharedNotebookIds
		value1 := argvalue1
		fmt.Print(client.ExpungeSharedNotebooks(value0, value1))
		fmt.Print("\n")
		break
	case "createLinkedNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CreateLinkedNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg628 := flag.Arg(2)
		mbTrans629 := thrift.NewTMemoryBufferLen(len(arg628))
		defer mbTrans629.Close()
		_, err630 := mbTrans629.WriteString(arg628)
		if err630 != nil {
			Usage()
			return
		}
		factory631 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt632 := factory631.GetProtocol(mbTrans629)
		argvalue1 := NoteStore.NewLinkedNotebook()
		err633 := argvalue1.Read(jsProt632)
		if err633 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.CreateLinkedNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "updateLinkedNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateLinkedNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg635 := flag.Arg(2)
		mbTrans636 := thrift.NewTMemoryBufferLen(len(arg635))
		defer mbTrans636.Close()
		_, err637 := mbTrans636.WriteString(arg635)
		if err637 != nil {
			Usage()
			return
		}
		factory638 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt639 := factory638.GetProtocol(mbTrans636)
		argvalue1 := NoteStore.NewLinkedNotebook()
		err640 := argvalue1.Read(jsProt639)
		if err640 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateLinkedNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "listLinkedNotebooks":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ListLinkedNotebooks requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.ListLinkedNotebooks(value0))
		fmt.Print("\n")
		break
	case "expungeLinkedNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ExpungeLinkedNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.ExpungeLinkedNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "authenticateToSharedNotebook":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "AuthenticateToSharedNotebook requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.AuthenticateToSharedNotebook(value0, value1))
		fmt.Print("\n")
		break
	case "getSharedNotebookByAuth":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetSharedNotebookByAuth requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetSharedNotebookByAuth(value0))
		fmt.Print("\n")
		break
	case "emailNote":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "EmailNote requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg648 := flag.Arg(2)
		mbTrans649 := thrift.NewTMemoryBufferLen(len(arg648))
		defer mbTrans649.Close()
		_, err650 := mbTrans649.WriteString(arg648)
		if err650 != nil {
			Usage()
			return
		}
		factory651 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt652 := factory651.GetProtocol(mbTrans649)
		argvalue1 := NoteStore.NewNoteEmailParameters()
		err653 := argvalue1.Read(jsProt652)
		if err653 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.EmailNote(value0, value1))
		fmt.Print("\n")
		break
	case "shareNote":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ShareNote requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.ShareNote(value0, value1))
		fmt.Print("\n")
		break
	case "stopSharingNote":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "StopSharingNote requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := NoteStore.Guid(argvalue1)
		fmt.Print(client.StopSharingNote(value0, value1))
		fmt.Print("\n")
		break
	case "authenticateToSharedNote":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "AuthenticateToSharedNote requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.AuthenticateToSharedNote(value0, value1, value2))
		fmt.Print("\n")
		break
	case "findRelated":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "FindRelated requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg662 := flag.Arg(2)
		mbTrans663 := thrift.NewTMemoryBufferLen(len(arg662))
		defer mbTrans663.Close()
		_, err664 := mbTrans663.WriteString(arg662)
		if err664 != nil {
			Usage()
			return
		}
		factory665 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt666 := factory665.GetProtocol(mbTrans663)
		argvalue1 := NoteStore.NewRelatedQuery()
		err667 := argvalue1.Read(jsProt666)
		if err667 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg668 := flag.Arg(3)
		mbTrans669 := thrift.NewTMemoryBufferLen(len(arg668))
		defer mbTrans669.Close()
		_, err670 := mbTrans669.WriteString(arg668)
		if err670 != nil {
			Usage()
			return
		}
		factory671 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt672 := factory671.GetProtocol(mbTrans669)
		argvalue2 := NoteStore.NewRelatedResultSpec()
		err673 := argvalue2.Read(jsProt672)
		if err673 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.FindRelated(value0, value1, value2))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := servicessync.NewPrivateMessageManagerSyncClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "addPrivateMessage":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "AddPrivateMessage requires 1 args")
			flag.Usage()
		}
		arg751 := flag.Arg(1)
		mbTrans752 := thrift.NewTMemoryBufferLen(len(arg751))
		defer mbTrans752.Close()
		_, err753 := mbTrans752.WriteString(arg751)
		if err753 != nil {
			Usage()
			return
		}
		factory754 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt755 := factory754.GetProtocol(mbTrans752)
		argvalue0 := servicessync.NewPrivateMessage()
		err756 := argvalue0.Read(jsProt755)
		if err756 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.AddPrivateMessage(value0))
		fmt.Print("\n")
		break
	case "getPrivateMessageList":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "GetPrivateMessageList requires 6 args")
			flag.Usage()
		}
		argvalue0, err757 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err757 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err758 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err758 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2, err759 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err759 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		argvalue3, err760 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err760 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		argvalue4 := flag.Arg(5) == "true"
		value4 := argvalue4
		tmp5, err762 := (strconv.Atoi(flag.Arg(6)))
		if err762 != nil {
			Usage()
			return
		}
		argvalue5 := int32(tmp5)
		value5 := argvalue5
		fmt.Print(client.GetPrivateMessageList(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "updateReadStatus":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "UpdateReadStatus requires 1 args")
			flag.Usage()
		}
		argvalue0, err763 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err763 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.UpdateReadStatus(value0))
		fmt.Print("\n")
		break
	case "deletePrivateMessage":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "DeletePrivateMessage requires 1 args")
			flag.Usage()
		}
		arg764 := flag.Arg(1)
		mbTrans765 := thrift.NewTMemoryBufferLen(len(arg764))
		defer mbTrans765.Close()
		_, err766 := mbTrans765.WriteString(arg764)
		if err766 != nil {
			Usage()
			return
		}
		factory767 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt768 := factory767.GetProtocol(mbTrans765)
		containerStruct0 := servicessync.NewDeletePrivateMessageArgs()
		err769 := containerStruct0.ReadField1(jsProt768)
		if err769 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.KeyList
		value0 := argvalue0
		fmt.Print(client.DeletePrivateMessage(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 15
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := services.NewRecommendationManagerClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "getResourceRecommendation":
		if flag.NArg()-1 != 7 {
			fmt.Fprintln(os.Stderr, "GetResourceRecommendation requires 7 args")
			flag.Usage()
		}
		argvalue0, err1405 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err1405 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := services.ResourceType(tmp1)
		value1 := argvalue1
		tmp2, err1406 := (strconv.Atoi(flag.Arg(3)))
		if err1406 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		tmp3, err1407 := (strconv.Atoi(flag.Arg(4)))
		if err1407 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		arg1408 := flag.Arg(5)
		mbTrans1409 := thrift.NewTMemoryBufferLen(len(arg1408))
		defer mbTrans1409.Close()
		_, err1410 := mbTrans1409.WriteString(arg1408)
		if err1410 != nil {
			Usage()
			return
		}
		factory1411 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1412 := factory1411.GetProtocol(mbTrans1409)
		argvalue4 := services.NewRecommendationAugmentInfo()
		err1413 := argvalue4.Read(jsProt1412)
		if err1413 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		tmp5, err := (strconv.Atoi(flag.Arg(6)))
		if err != nil {
			Usage()
			return
		}
		argvalue5 := services.RecommendationReason(tmp5)
		value5 := argvalue5
		arg1414 := flag.Arg(7)
		mbTrans1415 := thrift.NewTMemoryBufferLen(len(arg1414))
		defer mbTrans1415.Close()
		_, err1416 := mbTrans1415.WriteString(arg1414)
		if err1416 != nil {
			Usage()
			return
		}
		factory1417 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1418 := factory1417.GetProtocol(mbTrans1415)
		argvalue6 := services.NewFromInfo()
		err1419 := argvalue6.Read(jsProt1418)
		if err1419 != nil {
			Usage()
			return
		}
		value6 := argvalue6
		fmt.Print(client.GetResourceRecommendation(value0, value1, value2, value3, value4, value5, value6))
		fmt.Print("\n")
		break
	case "getGroupRecommendation":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "GetGroupRecommendation requires 6 args")
			flag.Usage()
		}
		argvalue0, err1420 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err1420 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err1421 := (strconv.Atoi(flag.Arg(2)))
		if err1421 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		tmp2, err1422 := (strconv.Atoi(flag.Arg(3)))
		if err1422 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := services.RecommendationReason(tmp3)
		value3 := argvalue3
		arg1423 := flag.Arg(5)
		mbTrans1424 := thrift.NewTMemoryBufferLen(len(arg1423))
		defer mbTrans1424.Close()
		_, err1425 := mbTrans1424.WriteString(arg1423)
		if err1425 != nil {
			Usage()
			return
		}
		factory1426 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1427 := factory1426.GetProtocol(mbTrans1424)
		argvalue4 := services.NewRecommendationAugmentInfo()
		err1428 := argvalue4.Read(jsProt1427)
		if err1428 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		arg1429 := flag.Arg(6)
		mbTrans1430 := thrift.NewTMemoryBufferLen(len(arg1429))
		defer mbTrans1430.Close()
		_, err1431 := mbTrans1430.WriteString(arg1429)
		if err1431 != nil {
			Usage()
			return
		}
		factory1432 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1433 := factory1432.GetProtocol(mbTrans1430)
		argvalue5 := services.NewFromInfo()
		err1434 := argvalue5.Read(jsProt1433)
		if err1434 != nil {
			Usage()
			return
		}
		value5 := argvalue5
		fmt.Print(client.GetGroupRecommendation(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "getTagRecommendation":
		if flag.NArg()-1 != 7 {
			fmt.Fprintln(os.Stderr, "GetTagRecommendation requires 7 args")
			flag.Usage()
		}
		argvalue0, err1435 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err1435 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg1436 := flag.Arg(2)
		mbTrans1437 := thrift.NewTMemoryBufferLen(len(arg1436))
		defer mbTrans1437.Close()
		_, err1438 := mbTrans1437.WriteString(arg1436)
		if err1438 != nil {
			Usage()
			return
		}
		factory1439 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1440 := factory1439.GetProtocol(mbTrans1437)
		containerStruct1 := services.NewGetTagRecommendationArgs()
		err1441 := containerStruct1.ReadField2(jsProt1440)
		if err1441 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.TagList
		value1 := argvalue1
		tmp2, err1442 := (strconv.Atoi(flag.Arg(3)))
		if err1442 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		tmp3, err1443 := (strconv.Atoi(flag.Arg(4)))
		if err1443 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		tmp4, err := (strconv.Atoi(flag.Arg(5)))
		if err != nil {
			Usage()
			return
		}
		argvalue4 := services.RecommendationReason(tmp4)
		value4 := argvalue4
		tmp5, err := (strconv.Atoi(flag.Arg(6)))
		if err != nil {
			Usage()
			return
		}
		argvalue5 := services.ResourceType(tmp5)
		value5 := argvalue5
		arg1444 := flag.Arg(7)
		mbTrans1445 := thrift.NewTMemoryBufferLen(len(arg1444))
		defer mbTrans1445.Close()
		_, err1446 := mbTrans1445.WriteString(arg1444)
		if err1446 != nil {
			Usage()
			return
		}
		factory1447 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1448 := factory1447.GetProtocol(mbTrans1445)
		argvalue6 := services.NewFromInfo()
		err1449 := argvalue6.Read(jsProt1448)
		if err1449 != nil {
			Usage()
			return
		}
		value6 := argvalue6
		fmt.Print(client.GetTagRecommendation(value0, value1, value2, value3, value4, value5, value6))
		fmt.Print("\n")
		break
	case "getFriendRecommendation":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "GetFriendRecommendation requires 5 args")
			flag.Usage()
		}
		argvalue0, err1450 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err1450 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err1451 := (strconv.Atoi(flag.Arg(2)))
		if err1451 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		tmp2, err1452 := (strconv.Atoi(flag.Arg(3)))
		if err1452 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := services.RecommendationReason(tmp3)
		value3 := argvalue3
		arg1453 := flag.Arg(5)
		mbTrans1454 := thrift.NewTMemoryBufferLen(len(arg1453))
		defer mbTrans1454.Close()
		_, err1455 := mbTrans1454.WriteString(arg1453)
		if err1455 != nil {
			Usage()
			return
		}
		factory1456 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1457 := factory1456.GetProtocol(mbTrans1454)
		argvalue4 := services.NewFromInfo()
		err1458 := argvalue4.Read(jsProt1457)
		if err1458 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		fmt.Print(client.GetFriendRecommendation(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "getRecommendationByMix":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "GetRecommendationByMix requires 6 args")
			flag.Usage()
		}
		argvalue0, err1459 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err1459 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err1460 := (strconv.Atoi(flag.Arg(2)))
		if err1460 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		tmp2, err1461 := (strconv.Atoi(flag.Arg(3)))
		if err1461 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := services.RecommendationReason(tmp3)
		value3 := argvalue3
		arg1462 := flag.Arg(5)
		mbTrans1463 := thrift.NewTMemoryBufferLen(len(arg1462))
		defer mbTrans1463.Close()
		_, err1464 := mbTrans1463.WriteString(arg1462)
		if err1464 != nil {
			Usage()
			return
		}
		factory1465 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1466 := factory1465.GetProtocol(mbTrans1463)
		argvalue4 := services.NewRecommendationAugmentInfo()
		err1467 := argvalue4.Read(jsProt1466)
		if err1467 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		arg1468 := flag.Arg(6)
		mbTrans1469 := thrift.NewTMemoryBufferLen(len(arg1468))
		defer mbTrans1469.Close()
		_, err1470 := mbTrans1469.WriteString(arg1468)
		if err1470 != nil {
			Usage()
			return
		}
		factory1471 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1472 := factory1471.GetProtocol(mbTrans1469)
		argvalue5 := services.NewFromInfo()
		err1473 := argvalue5.Read(jsProt1472)
		if err1473 != nil {
			Usage()
			return
		}
		value5 := argvalue5
		fmt.Print(client.GetRecommendationByMix(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 16
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := services.NewUserRelationManagerClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "setRemark":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "SetRemark requires 3 args")
			flag.Usage()
		}
		argvalue0, err595 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err595 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		arg597 := flag.Arg(3)
		mbTrans598 := thrift.NewTMemoryBufferLen(len(arg597))
		defer mbTrans598.Close()
		_, err599 := mbTrans598.WriteString(arg597)
		if err599 != nil {
			Usage()
			return
		}
		factory600 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt601 := factory600.GetProtocol(mbTrans598)
		argvalue2 := services.NewFromInfo()
		err602 := argvalue2.Read(jsProt601)
		if err602 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.SetRemark(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getRemarks":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "GetRemarks requires 3 args")
			flag.Usage()
		}
		argvalue0, err603 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err603 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err604 := (strconv.Atoi(flag.Arg(2)))
		if err604 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		arg605 := flag.Arg(3)
		mbTrans606 := thrift.NewTMemoryBufferLen(len(arg605))
		defer mbTrans606.Close()
		_, err607 := mbTrans606.WriteString(arg605)
		if err607 != nil {
			Usage()
			return
		}
		factory608 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt609 := factory608.GetProtocol(mbTrans606)
		argvalue2 := services.NewFromInfo()
		err610 := argvalue2.Read(jsProt609)
		if err610 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.GetRemarks(value0, value1, value2))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 17
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := servicessync.NewChatManagerSyncClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "deleteChatMessage":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "DeleteChatMessage requires 1 args")
			flag.Usage()
		}
		arg14 := flag.Arg(1)
		mbTrans15 := thrift.NewTMemoryBufferLen(len(arg14))
		defer mbTrans15.Close()
		_, err16 := mbTrans15.WriteString(arg14)
		if err16 != nil {
			Usage()
			return
		}
		factory17 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt18 := factory17.GetProtocol(mbTrans15)
		argvalue0 := servicessync.NewChatMessage()
		err19 := argvalue0.Read(jsProt18)
		if err19 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.DeleteChatMessage(value0))
		fmt.Print("\n")
		break
	case "getChatMessages":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetChatMessages requires 2 args")
			flag.Usage()
		}
		arg20 := flag.Arg(1)
		mbTrans21 := thrift.NewTMemoryBufferLen(len(arg20))
		defer mbTrans21.Close()
		_, err22 := mbTrans21.WriteString(arg20)
		if err22 != nil {
			Usage()
			return
		}
		factory23 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt24 := factory23.GetProtocol(mbTrans21)
		containerStruct0 := servicessync.NewGetChatMessagesArgs()
		err25 := containerStruct0.ReadField1(jsProt24)
		if err25 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Messages
		value0 := argvalue0
		tmp1, err26 := (strconv.Atoi(flag.Arg(2)))
		if err26 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		fmt.Print(client.GetChatMessages(value0, value1))
		fmt.Print("\n")
		break
	case "getLatestChatMessages":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetLatestChatMessages requires 2 args")
			flag.Usage()
		}
		argvalue0, err27 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err27 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err28 := (strconv.Atoi(flag.Arg(2)))
		if err28 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		fmt.Print(client.GetLatestChatMessages(value0, value1))
		fmt.Print("\n")
		break
	case "getGroupMessages":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "GetGroupMessages requires 5 args")
			flag.Usage()
		}
		argvalue0, err29 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err29 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err30 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err30 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2, err31 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err31 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		argvalue3 := flag.Arg(4) == "true"
		value3 := argvalue3
		tmp4, err33 := (strconv.Atoi(flag.Arg(5)))
		if err33 != nil {
			Usage()
			return
		}
		argvalue4 := int32(tmp4)
		value4 := argvalue4
		fmt.Print(client.GetGroupMessages(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := bolt.NewComputationServiceClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "init":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "Init requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.Init())
		fmt.Print("\n")
		break
	case "destroy":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "Destroy requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.Destroy())
		fmt.Print("\n")
		break
	case "boltProcessRecords":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "BoltProcessRecords requires 1 args")
			flag.Usage()
		}
		arg45 := flag.Arg(1)
		mbTrans46 := thrift.NewTMemoryBufferLen(len(arg45))
		defer mbTrans46.Close()
		_, err47 := mbTrans46.WriteString(arg45)
		if err47 != nil {
			Usage()
			return
		}
		factory48 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt49 := factory48.GetProtocol(mbTrans46)
		containerStruct0 := bolt.NewBoltProcessRecordsArgs()
		err50 := containerStruct0.ReadField1(jsProt49)
		if err50 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Records
		value0 := argvalue0
		fmt.Print(client.BoltProcessRecords(value0))
		fmt.Print("\n")
		break
	case "boltProcessTimer":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "BoltProcessTimer requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1, err52 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err52 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.BoltProcessTimer(value0, value1))
		fmt.Print("\n")
		break
	case "boltMetadata":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "BoltMetadata requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.BoltMetadata())
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := bolt.NewBoltSchedulerServiceClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "deployComputation":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "DeployComputation requires 1 args")
			flag.Usage()
		}
		arg102 := flag.Arg(1)
		mbTrans103 := thrift.NewTMemoryBufferLen(len(arg102))
		defer mbTrans103.Close()
		_, err104 := mbTrans103.WriteString(arg102)
		if err104 != nil {
			Usage()
			return
		}
		factory105 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt106 := factory105.GetProtocol(mbTrans103)
		argvalue0 := bolt.NewBoltComputationRequest()
		err107 := argvalue0.Read(jsProt106)
		if err107 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.DeployComputation(value0))
		fmt.Print("\n")
		break
	case "getComputationSlug":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetComputationSlug requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetComputationSlug(value0))
		fmt.Print("\n")
		break
	case "registerComputation":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "RegisterComputation requires 1 args")
			flag.Usage()
		}
		arg109 := flag.Arg(1)
		mbTrans110 := thrift.NewTMemoryBufferLen(len(arg109))
		defer mbTrans110.Close()
		_, err111 := mbTrans110.WriteString(arg109)
		if err111 != nil {
			Usage()
			return
		}
		factory112 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt113 := factory112.GetProtocol(mbTrans110)
		argvalue0 := bolt.NewComputationMetadata()
		err114 := argvalue0.Read(jsProt113)
		if err114 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.RegisterComputation(value0))
		fmt.Print("\n")
		break
	case "scaleComputation":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ScaleComputation requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1, err116 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err116 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.ScaleComputation(value0, value1))
		fmt.Print("\n")
		break
	case "killTask":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "KillTask requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.KillTask(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 20
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := tutorial.NewCalculatorClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "ping":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "Ping requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.Ping())
		fmt.Print("\n")
		break
	case "add":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "Add requires 2 args")
			flag.Usage()
		}
		tmp0, err7 := (strconv.Atoi(flag.Arg(1)))
		if err7 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		tmp1, err8 := (strconv.Atoi(flag.Arg(2)))
		if err8 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		fmt.Print(client.Add(value0, value1))
		fmt.Print("\n")
		break
	case "calculate":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "Calculate requires 2 args")
			flag.Usage()
		}
		tmp0, err9 := (strconv.Atoi(flag.Arg(1)))
		if err9 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		arg10 := flag.Arg(2)
		mbTrans11 := thrift.NewTMemoryBufferLen(len(arg10))
		defer mbTrans11.Close()
		_, err12 := mbTrans11.WriteString(arg10)
		if err12 != nil {
			Usage()
			return
		}
		factory13 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt14 := factory13.GetProtocol(mbTrans11)
		argvalue1 := tutorial.NewWork()
		err15 := argvalue1.Read(jsProt14)
		if err15 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.Calculate(value0, value1))
		fmt.Print("\n")
		break
	case "zip":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "Zip requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.Zip())
		fmt.Print("\n")
		break
	case "getStruct":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetStruct requires 1 args")
			flag.Usage()
		}
		tmp0, err16 := (strconv.Atoi(flag.Arg(1)))
		if err16 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := argvalue0
		fmt.Print(client.GetStruct(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 21
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := services.NewAreaSvcClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "createArea":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CreateArea requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg144 := flag.Arg(2)
		mbTrans145 := thrift.NewTMemoryBufferLen(len(arg144))
		defer mbTrans145.Close()
		_, err146 := mbTrans145.WriteString(arg144)
		if err146 != nil {
			Usage()
			return
		}
		factory147 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt148 := factory147.GetProtocol(mbTrans145)
		argvalue1 := services.NewArea()
		err149 := argvalue1.Read(jsProt148)
		if err149 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.CreateArea(value0, value1))
		fmt.Print("\n")
		break
	case "updateArea":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateArea requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg151 := flag.Arg(2)
		mbTrans152 := thrift.NewTMemoryBufferLen(len(arg151))
		defer mbTrans152.Close()
		_, err153 := mbTrans152.WriteString(arg151)
		if err153 != nil {
			Usage()
			return
		}
		factory154 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt155 := factory154.GetProtocol(mbTrans152)
		argvalue1 := services.NewArea()
		err156 := argvalue1.Read(jsProt155)
		if err156 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateArea(value0, value1))
		fmt.Print("\n")
		break
	case "deleteArea":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "DeleteArea requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg158 := flag.Arg(2)
		mbTrans159 := thrift.NewTMemoryBufferLen(len(arg158))
		defer mbTrans159.Close()
		_, err160 := mbTrans159.WriteString(arg158)
		if err160 != nil {
			Usage()
			return
		}
		factory161 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt162 := factory161.GetProtocol(mbTrans159)
		argvalue1 := services.NewArea()
		err163 := argvalue1.Read(jsProt162)
		if err163 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.DeleteArea(value0, value1))
		fmt.Print("\n")
		break
	case "getAreaById":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetAreaById requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.GetAreaById(value0, value1))
		fmt.Print("\n")
		break
	case "wasHere":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "WasHere requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2, err168 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err168 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.WasHere(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getNearBy":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "GetNearBy requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg170 := flag.Arg(2)
		mbTrans171 := thrift.NewTMemoryBufferLen(len(arg170))
		defer mbTrans171.Close()
		_, err172 := mbTrans171.WriteString(arg170)
		if err172 != nil {
			Usage()
			return
		}
		factory173 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt174 := factory173.GetProtocol(mbTrans171)
		argvalue1 := services.NewCoordinate()
		err175 := argvalue1.Read(jsProt174)
		if err175 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err176 := (strconv.Atoi(flag.Arg(3)))
		if err176 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		fmt.Print(client.GetNearBy(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getAllAreasInCity":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetAllAreasInCity requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetAllAreasInCity(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 22
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := services.NewSearchManagerClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "searchPublicResources":
		if flag.NArg()-1 != 9 {
			fmt.Fprintln(os.Stderr, "SearchPublicResources requires 9 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := services.SearchCategory(tmp1)
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := services.ResourceType(tmp2)
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := services.Zone(tmp3)
		value3 := argvalue3
		tmp4, err1256 := (strconv.Atoi(flag.Arg(5)))
		if err1256 != nil {
			Usage()
			return
		}
		argvalue4 := int32(tmp4)
		value4 := argvalue4
		tmp5, err1257 := (strconv.Atoi(flag.Arg(6)))
		if err1257 != nil {
			Usage()
			return
		}
		argvalue5 := int32(tmp5)
		value5 := argvalue5
		arg1258 := flag.Arg(7)
		mbTrans1259 := thrift.NewTMemoryBufferLen(len(arg1258))
		defer mbTrans1259.Close()
		_, err1260 := mbTrans1259.WriteString(arg1258)
		if err1260 != nil {
			Usage()
			return
		}
		factory1261 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1262 := factory1261.GetProtocol(mbTrans1259)
		containerStruct6 := services.NewSearchPublicResourcesArgs()
		err1263 := containerStruct6.ReadField7(jsProt1262)
		if err1263 != nil {
			Usage()
			return
		}
		argvalue6 := containerStruct6.Sortlist
		value6 := argvalue6
		arg1264 := flag.Arg(8)
		mbTrans1265 := thrift.NewTMemoryBufferLen(len(arg1264))
		defer mbTrans1265.Close()
		_, err1266 := mbTrans1265.WriteString(arg1264)
		if err1266 != nil {
			Usage()
			return
		}
		factory1267 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1268 := factory1267.GetProtocol(mbTrans1265)
		containerStruct7 := services.NewSearchPublicResourcesArgs()
		err1269 := containerStruct7.ReadField8(jsProt1268)
		if err1269 != nil {
			Usage()
			return
		}
		argvalue7 := containerStruct7.Filterlist
		value7 := argvalue7
		arg1270 := flag.Arg(9)
		mbTrans1271 := thrift.NewTMemoryBufferLen(len(arg1270))
		defer mbTrans1271.Close()
		_, err1272 := mbTrans1271.WriteString(arg1270)
		if err1272 != nil {
			Usage()
			return
		}
		factory1273 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1274 := factory1273.GetProtocol(mbTrans1271)
		argvalue8 := services.NewFromInfo()
		err1275 := argvalue8.Read(jsProt1274)
		if err1275 != nil {
			Usage()
			return
		}
		value8 := argvalue8
		fmt.Print(client.SearchPublicResources(value0, value1, value2, value3, value4, value5, value6, value7, value8))
		fmt.Print("\n")
		break
	case "searchGroupResources":
		if flag.NArg()-1 != 9 {
			fmt.Fprintln(os.Stderr, "SearchGroupResources requires 9 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1, err1277 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err1277 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := services.ResourceType(tmp2)
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := services.Zone(tmp3)
		value3 := argvalue3
		tmp4, err1278 := (strconv.Atoi(flag.Arg(5)))
		if err1278 != nil {
			Usage()
			return
		}
		argvalue4 := int32(tmp4)
		value4 := argvalue4
		tmp5, err1279 := (strconv.Atoi(flag.Arg(6)))
		if err1279 != nil {
			Usage()
			return
		}
		argvalue5 := int32(tmp5)
		value5 := argvalue5
		arg1280 := flag.Arg(7)
		mbTrans1281 := thrift.NewTMemoryBufferLen(len(arg1280))
		defer mbTrans1281.Close()
		_, err1282 := mbTrans1281.WriteString(arg1280)
		if err1282 != nil {
			Usage()
			return
		}
		factory1283 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1284 := factory1283.GetProtocol(mbTrans1281)
		containerStruct6 := services.NewSearchGroupResourcesArgs()
		err1285 := containerStruct6.ReadField7(jsProt1284)
		if err1285 != nil {
			Usage()
			return
		}
		argvalue6 := containerStruct6.Sortlist
		value6 := argvalue6
		arg1286 := flag.Arg(8)
		mbTrans1287 := thrift.NewTMemoryBufferLen(len(arg1286))
		defer mbTrans1287.Close()
		_, err1288 := mbTrans1287.WriteString(arg1286)
		if err1288 != nil {
			Usage()
			return
		}
		factory1289 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1290 := factory1289.GetProtocol(mbTrans1287)
		containerStruct7 := services.NewSearchGroupResourcesArgs()
		err1291 := containerStruct7.ReadField8(jsProt1290)
		if err1291 != nil {
			Usage()
			return
		}
		argvalue7 := containerStruct7.Filterlist
		value7 := argvalue7
		arg1292 := flag.Arg(9)
		mbTrans1293 := thrift.NewTMemoryBufferLen(len(arg1292))
		defer mbTrans1293.Close()
		_, err1294 := mbTrans1293.WriteString(arg1292)
		if err1294 != nil {
			Usage()
			return
		}
		factory1295 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1296 := factory1295.GetProtocol(mbTrans1293)
		argvalue8 := services.NewFromInfo()
		err1297 := argvalue8.Read(jsProt1296)
		if err1297 != nil {
			Usage()
			return
		}
		value8 := argvalue8
		fmt.Print(client.SearchGroupResources(value0, value1, value2, value3, value4, value5, value6, value7, value8))
		fmt.Print("\n")
		break
	case "searchGroup":
		if flag.NArg()-1 != 7 {
			fmt.Fprintln(os.Stderr, "SearchGroup requires 7 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := services.GroupType(tmp1)
		value1 := argvalue1
		tmp2, err1299 := (strconv.Atoi(flag.Arg(3)))
		if err1299 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		tmp3, err1300 := (strconv.Atoi(flag.Arg(4)))
		if err1300 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		arg1301 := flag.Arg(5)
		mbTrans1302 := thrift.NewTMemoryBufferLen(len(arg1301))
		defer mbTrans1302.Close()
		_, err1303 := mbTrans1302.WriteString(arg1301)
		if err1303 != nil {
			Usage()
			return
		}
		factory1304 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1305 := factory1304.GetProtocol(mbTrans1302)
		containerStruct4 := services.NewSearchGroupArgs()
		err1306 := containerStruct4.ReadField5(jsProt1305)
		if err1306 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Sortlist
		value4 := argvalue4
		arg1307 := flag.Arg(6)
		mbTrans1308 := thrift.NewTMemoryBufferLen(len(arg1307))
		defer mbTrans1308.Close()
		_, err1309 := mbTrans1308.WriteString(arg1307)
		if err1309 != nil {
			Usage()
			return
		}
		factory1310 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1311 := factory1310.GetProtocol(mbTrans1308)
		containerStruct5 := services.NewSearchGroupArgs()
		err1312 := containerStruct5.ReadField6(jsProt1311)
		if err1312 != nil {
			Usage()
			return
		}
		argvalue5 := containerStruct5.Filterlist
		value5 := argvalue5
		arg1313 := flag.Arg(7)
		mbTrans1314 := thrift.NewTMemoryBufferLen(len(arg1313))
		defer mbTrans1314.Close()
		_, err1315 := mbTrans1314.WriteString(arg1313)
		if err1315 != nil {
			Usage()
			return
		}
		factory1316 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1317 := factory1316.GetProtocol(mbTrans1314)
		argvalue6 := services.NewFromInfo()
		err1318 := argvalue6.Read(jsProt1317)
		if err1318 != nil {
			Usage()
			return
		}
		value6 := argvalue6
		fmt.Print(client.SearchGroup(value0, value1, value2, value3, value4, value5, value6))
		fmt.Print("\n")
		break
	case "searchUser":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "SearchUser requires 4 args")
			flag.Usage()
		}
		arg1319 := flag.Arg(1)
		mbTrans1320 := thrift.NewTMemoryBufferLen(len(arg1319))
		defer mbTrans1320.Close()
		_, err1321 := mbTrans1320.WriteString(arg1319)
		if err1321 != nil {
			Usage()
			return
		}
		factory1322 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1323 := factory1322.GetProtocol(mbTrans1320)
		argvalue0 := services.NewUserSearchInfo()
		err1324 := argvalue0.Read(jsProt1323)
		if err1324 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg1325 := flag.Arg(2)
		mbTrans1326 := thrift.NewTMemoryBufferLen(len(arg1325))
		defer mbTrans1326.Close()
		_, err1327 := mbTrans1326.WriteString(arg1325)
		if err1327 != nil {
			Usage()
			return
		}
		factory1328 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1329 := factory1328.GetProtocol(mbTrans1326)
		containerStruct1 := services.NewSearchUserArgs()
		err1330 := containerStruct1.ReadField2(jsProt1329)
		if err1330 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Sortlist
		value1 := argvalue1
		arg1331 := flag.Arg(3)
		mbTrans1332 := thrift.NewTMemoryBufferLen(len(arg1331))
		defer mbTrans1332.Close()
		_, err1333 := mbTrans1332.WriteString(arg1331)
		if err1333 != nil {
			Usage()
			return
		}
		factory1334 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1335 := factory1334.GetProtocol(mbTrans1332)
		containerStruct2 := services.NewSearchUserArgs()
		err1336 := containerStruct2.ReadField3(jsProt1335)
		if err1336 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Filterlist
		value2 := argvalue2
		arg1337 := flag.Arg(4)
		mbTrans1338 := thrift.NewTMemoryBufferLen(len(arg1337))
		defer mbTrans1338.Close()
		_, err1339 := mbTrans1338.WriteString(arg1337)
		if err1339 != nil {
			Usage()
			return
		}
		factory1340 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1341 := factory1340.GetProtocol(mbTrans1338)
		argvalue3 := services.NewFromInfo()
		err1342 := argvalue3.Read(jsProt1341)
		if err1342 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.SearchUser(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "searchResourceByTag":
		if flag.NArg()-1 != 8 {
			fmt.Fprintln(os.Stderr, "SearchResourceByTag requires 8 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := services.ResourceType(tmp1)
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := services.Zone(tmp2)
		value2 := argvalue2
		tmp3, err1344 := (strconv.Atoi(flag.Arg(4)))
		if err1344 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		tmp4, err1345 := (strconv.Atoi(flag.Arg(5)))
		if err1345 != nil {
			Usage()
			return
		}
		argvalue4 := int32(tmp4)
		value4 := argvalue4
		arg1346 := flag.Arg(6)
		mbTrans1347 := thrift.NewTMemoryBufferLen(len(arg1346))
		defer mbTrans1347.Close()
		_, err1348 := mbTrans1347.WriteString(arg1346)
		if err1348 != nil {
			Usage()
			return
		}
		factory1349 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1350 := factory1349.GetProtocol(mbTrans1347)
		containerStruct5 := services.NewSearchResourceByTagArgs()
		err1351 := containerStruct5.ReadField6(jsProt1350)
		if err1351 != nil {
			Usage()
			return
		}
		argvalue5 := containerStruct5.Sortlist
		value5 := argvalue5
		arg1352 := flag.Arg(7)
		mbTrans1353 := thrift.NewTMemoryBufferLen(len(arg1352))
		defer mbTrans1353.Close()
		_, err1354 := mbTrans1353.WriteString(arg1352)
		if err1354 != nil {
			Usage()
			return
		}
		factory1355 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1356 := factory1355.GetProtocol(mbTrans1353)
		containerStruct6 := services.NewSearchResourceByTagArgs()
		err1357 := containerStruct6.ReadField7(jsProt1356)
		if err1357 != nil {
			Usage()
			return
		}
		argvalue6 := containerStruct6.Filterlist
		value6 := argvalue6
		arg1358 := flag.Arg(8)
		mbTrans1359 := thrift.NewTMemoryBufferLen(len(arg1358))
		defer mbTrans1359.Close()
		_, err1360 := mbTrans1359.WriteString(arg1358)
		if err1360 != nil {
			Usage()
			return
		}
		factory1361 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1362 := factory1361.GetProtocol(mbTrans1359)
		argvalue7 := services.NewFromInfo()
		err1363 := argvalue7.Read(jsProt1362)
		if err1363 != nil {
			Usage()
			return
		}
		value7 := argvalue7
		fmt.Print(client.SearchResourceByTag(value0, value1, value2, value3, value4, value5, value6, value7))
		fmt.Print("\n")
		break
	case "searchGroupIds":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "SearchGroupIds requires 5 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := services.Zone(tmp1)
		value1 := argvalue1
		arg1365 := flag.Arg(3)
		mbTrans1366 := thrift.NewTMemoryBufferLen(len(arg1365))
		defer mbTrans1366.Close()
		_, err1367 := mbTrans1366.WriteString(arg1365)
		if err1367 != nil {
			Usage()
			return
		}
		factory1368 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1369 := factory1368.GetProtocol(mbTrans1366)
		containerStruct2 := services.NewSearchGroupIdsArgs()
		err1370 := containerStruct2.ReadField3(jsProt1369)
		if err1370 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Sortlist
		value2 := argvalue2
		arg1371 := flag.Arg(4)
		mbTrans1372 := thrift.NewTMemoryBufferLen(len(arg1371))
		defer mbTrans1372.Close()
		_, err1373 := mbTrans1372.WriteString(arg1371)
		if err1373 != nil {
			Usage()
			return
		}
		factory1374 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1375 := factory1374.GetProtocol(mbTrans1372)
		containerStruct3 := services.NewSearchGroupIdsArgs()
		err1376 := containerStruct3.ReadField4(jsProt1375)
		if err1376 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Filterlist
		value3 := argvalue3
		arg1377 := flag.Arg(5)
		mbTrans1378 := thrift.NewTMemoryBufferLen(len(arg1377))
		defer mbTrans1378.Close()
		_, err1379 := mbTrans1378.WriteString(arg1377)
		if err1379 != nil {
			Usage()
			return
		}
		factory1380 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1381 := factory1380.GetProtocol(mbTrans1378)
		argvalue4 := services.NewFromInfo()
		err1382 := argvalue4.Read(jsProt1381)
		if err1382 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		fmt.Print(client.SearchGroupIds(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "searchTags":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "SearchTags requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err1384 := (strconv.Atoi(flag.Arg(2)))
		if err1384 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		tmp2, err1385 := (strconv.Atoi(flag.Arg(3)))
		if err1385 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		arg1386 := flag.Arg(4)
		mbTrans1387 := thrift.NewTMemoryBufferLen(len(arg1386))
		defer mbTrans1387.Close()
		_, err1388 := mbTrans1387.WriteString(arg1386)
		if err1388 != nil {
			Usage()
			return
		}
		factory1389 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1390 := factory1389.GetProtocol(mbTrans1387)
		argvalue3 := services.NewFromInfo()
		err1391 := argvalue3.Read(jsProt1390)
		if err1391 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.SearchTags(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 23
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := tcliservice.NewTCLIServiceClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "OpenSession":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "OpenSession requires 1 args")
			flag.Usage()
		}
		arg60 := flag.Arg(1)
		mbTrans61 := thrift.NewTMemoryBufferLen(len(arg60))
		defer mbTrans61.Close()
		_, err62 := mbTrans61.WriteString(arg60)
		if err62 != nil {
			Usage()
			return
		}
		factory63 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt64 := factory63.GetProtocol(mbTrans61)
		argvalue0 := tcliservice.NewTOpenSessionReq()
		err65 := argvalue0.Read(jsProt64)
		if err65 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.OpenSession(value0))
		fmt.Print("\n")
		break
	case "CloseSession":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "CloseSession requires 1 args")
			flag.Usage()
		}
		arg66 := flag.Arg(1)
		mbTrans67 := thrift.NewTMemoryBufferLen(len(arg66))
		defer mbTrans67.Close()
		_, err68 := mbTrans67.WriteString(arg66)
		if err68 != nil {
			Usage()
			return
		}
		factory69 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt70 := factory69.GetProtocol(mbTrans67)
		argvalue0 := tcliservice.NewTCloseSessionReq()
		err71 := argvalue0.Read(jsProt70)
		if err71 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.CloseSession(value0))
		fmt.Print("\n")
		break
	case "GetInfo":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetInfo requires 1 args")
			flag.Usage()
		}
		arg72 := flag.Arg(1)
		mbTrans73 := thrift.NewTMemoryBufferLen(len(arg72))
		defer mbTrans73.Close()
		_, err74 := mbTrans73.WriteString(arg72)
		if err74 != nil {
			Usage()
			return
		}
		factory75 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt76 := factory75.GetProtocol(mbTrans73)
		argvalue0 := tcliservice.NewTGetInfoReq()
		err77 := argvalue0.Read(jsProt76)
		if err77 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetInfo(value0))
		fmt.Print("\n")
		break
	case "ExecuteStatement":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ExecuteStatement requires 1 args")
			flag.Usage()
		}
		arg78 := flag.Arg(1)
		mbTrans79 := thrift.NewTMemoryBufferLen(len(arg78))
		defer mbTrans79.Close()
		_, err80 := mbTrans79.WriteString(arg78)
		if err80 != nil {
			Usage()
			return
		}
		factory81 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt82 := factory81.GetProtocol(mbTrans79)
		argvalue0 := tcliservice.NewTExecuteStatementReq()
		err83 := argvalue0.Read(jsProt82)
		if err83 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.ExecuteStatement(value0))
		fmt.Print("\n")
		break
	case "GetTypeInfo":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetTypeInfo requires 1 args")
			flag.Usage()
		}
		arg84 := flag.Arg(1)
		mbTrans85 := thrift.NewTMemoryBufferLen(len(arg84))
		defer mbTrans85.Close()
		_, err86 := mbTrans85.WriteString(arg84)
		if err86 != nil {
			Usage()
			return
		}
		factory87 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt88 := factory87.GetProtocol(mbTrans85)
		argvalue0 := tcliservice.NewTGetTypeInfoReq()
		err89 := argvalue0.Read(jsProt88)
		if err89 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetTypeInfo(value0))
		fmt.Print("\n")
		break
	case "GetCatalogs":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetCatalogs requires 1 args")
			flag.Usage()
		}
		arg90 := flag.Arg(1)
		mbTrans91 := thrift.NewTMemoryBufferLen(len(arg90))
		defer mbTrans91.Close()
		_, err92 := mbTrans91.WriteString(arg90)
		if err92 != nil {
			Usage()
			return
		}
		factory93 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt94 := factory93.GetProtocol(mbTrans91)
		argvalue0 := tcliservice.NewTGetCatalogsReq()
		err95 := argvalue0.Read(jsProt94)
		if err95 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetCatalogs(value0))
		fmt.Print("\n")
		break
	case "GetSchemas":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetSchemas requires 1 args")
			flag.Usage()
		}
		arg96 := flag.Arg(1)
		mbTrans97 := thrift.NewTMemoryBufferLen(len(arg96))
		defer mbTrans97.Close()
		_, err98 := mbTrans97.WriteString(arg96)
		if err98 != nil {
			Usage()
			return
		}
		factory99 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt100 := factory99.GetProtocol(mbTrans97)
		argvalue0 := tcliservice.NewTGetSchemasReq()
		err101 := argvalue0.Read(jsProt100)
		if err101 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetSchemas(value0))
		fmt.Print("\n")
		break
	case "GetTables":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetTables requires 1 args")
			flag.Usage()
		}
		arg102 := flag.Arg(1)
		mbTrans103 := thrift.NewTMemoryBufferLen(len(arg102))
		defer mbTrans103.Close()
		_, err104 := mbTrans103.WriteString(arg102)
		if err104 != nil {
			Usage()
			return
		}
		factory105 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt106 := factory105.GetProtocol(mbTrans103)
		argvalue0 := tcliservice.NewTGetTablesReq()
		err107 := argvalue0.Read(jsProt106)
		if err107 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetTables(value0))
		fmt.Print("\n")
		break
	case "GetTableTypes":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetTableTypes requires 1 args")
			flag.Usage()
		}
		arg108 := flag.Arg(1)
		mbTrans109 := thrift.NewTMemoryBufferLen(len(arg108))
		defer mbTrans109.Close()
		_, err110 := mbTrans109.WriteString(arg108)
		if err110 != nil {
			Usage()
			return
		}
		factory111 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt112 := factory111.GetProtocol(mbTrans109)
		argvalue0 := tcliservice.NewTGetTableTypesReq()
		err113 := argvalue0.Read(jsProt112)
		if err113 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetTableTypes(value0))
		fmt.Print("\n")
		break
	case "GetColumns":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetColumns requires 1 args")
			flag.Usage()
		}
		arg114 := flag.Arg(1)
		mbTrans115 := thrift.NewTMemoryBufferLen(len(arg114))
		defer mbTrans115.Close()
		_, err116 := mbTrans115.WriteString(arg114)
		if err116 != nil {
			Usage()
			return
		}
		factory117 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt118 := factory117.GetProtocol(mbTrans115)
		argvalue0 := tcliservice.NewTGetColumnsReq()
		err119 := argvalue0.Read(jsProt118)
		if err119 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetColumns(value0))
		fmt.Print("\n")
		break
	case "GetFunctions":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetFunctions requires 1 args")
			flag.Usage()
		}
		arg120 := flag.Arg(1)
		mbTrans121 := thrift.NewTMemoryBufferLen(len(arg120))
		defer mbTrans121.Close()
		_, err122 := mbTrans121.WriteString(arg120)
		if err122 != nil {
			Usage()
			return
		}
		factory123 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt124 := factory123.GetProtocol(mbTrans121)
		argvalue0 := tcliservice.NewTGetFunctionsReq()
		err125 := argvalue0.Read(jsProt124)
		if err125 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetFunctions(value0))
		fmt.Print("\n")
		break
	case "GetOperationStatus":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetOperationStatus requires 1 args")
			flag.Usage()
		}
		arg126 := flag.Arg(1)
		mbTrans127 := thrift.NewTMemoryBufferLen(len(arg126))
		defer mbTrans127.Close()
		_, err128 := mbTrans127.WriteString(arg126)
		if err128 != nil {
			Usage()
			return
		}
		factory129 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt130 := factory129.GetProtocol(mbTrans127)
		argvalue0 := tcliservice.NewTGetOperationStatusReq()
		err131 := argvalue0.Read(jsProt130)
		if err131 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetOperationStatus(value0))
		fmt.Print("\n")
		break
	case "CancelOperation":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "CancelOperation requires 1 args")
			flag.Usage()
		}
		arg132 := flag.Arg(1)
		mbTrans133 := thrift.NewTMemoryBufferLen(len(arg132))
		defer mbTrans133.Close()
		_, err134 := mbTrans133.WriteString(arg132)
		if err134 != nil {
			Usage()
			return
		}
		factory135 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt136 := factory135.GetProtocol(mbTrans133)
		argvalue0 := tcliservice.NewTCancelOperationReq()
		err137 := argvalue0.Read(jsProt136)
		if err137 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.CancelOperation(value0))
		fmt.Print("\n")
		break
	case "CloseOperation":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "CloseOperation requires 1 args")
			flag.Usage()
		}
		arg138 := flag.Arg(1)
		mbTrans139 := thrift.NewTMemoryBufferLen(len(arg138))
		defer mbTrans139.Close()
		_, err140 := mbTrans139.WriteString(arg138)
		if err140 != nil {
			Usage()
			return
		}
		factory141 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt142 := factory141.GetProtocol(mbTrans139)
		argvalue0 := tcliservice.NewTCloseOperationReq()
		err143 := argvalue0.Read(jsProt142)
		if err143 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.CloseOperation(value0))
		fmt.Print("\n")
		break
	case "GetResultSetMetadata":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetResultSetMetadata requires 1 args")
			flag.Usage()
		}
		arg144 := flag.Arg(1)
		mbTrans145 := thrift.NewTMemoryBufferLen(len(arg144))
		defer mbTrans145.Close()
		_, err146 := mbTrans145.WriteString(arg144)
		if err146 != nil {
			Usage()
			return
		}
		factory147 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt148 := factory147.GetProtocol(mbTrans145)
		argvalue0 := tcliservice.NewTGetResultSetMetadataReq()
		err149 := argvalue0.Read(jsProt148)
		if err149 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetResultSetMetadata(value0))
		fmt.Print("\n")
		break
	case "FetchResults":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "FetchResults requires 1 args")
			flag.Usage()
		}
		arg150 := flag.Arg(1)
		mbTrans151 := thrift.NewTMemoryBufferLen(len(arg150))
		defer mbTrans151.Close()
		_, err152 := mbTrans151.WriteString(arg150)
		if err152 != nil {
			Usage()
			return
		}
		factory153 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt154 := factory153.GetProtocol(mbTrans151)
		argvalue0 := tcliservice.NewTFetchResultsReq()
		err155 := argvalue0.Read(jsProt154)
		if err155 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.FetchResults(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 24
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := User.NewUserSerClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "Register":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "Register requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.Register(value0, value1))
		fmt.Print("\n")
		break
	case "Login":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "Login requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.Login(value0, value1, value2))
		fmt.Print("\n")
		break
	case "Logout":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "Logout requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.Logout(value0, value1))
		fmt.Print("\n")
		break
	case "AppRegister":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "AppRegister requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.AppRegister(value0, value1, value2))
		fmt.Print("\n")
		break
	case "AppLogin":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "AppLogin requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		fmt.Print(client.AppLogin(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "AccessToken":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "AccessToken requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.AccessToken(value0, value1))
		fmt.Print("\n")
		break
	case "Authorize":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "Authorize requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		argvalue3 := flag.Arg(4)
		value3 := argvalue3
		fmt.Print(client.Authorize(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "Oauth2Token":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "Oauth2Token requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.Oauth2Token(value0, value1, value2))
		fmt.Print("\n")
		break
	case "UserInfo":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "UserInfo requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.UserInfo(value0, value1, value2))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 25
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = math.MinInt32 // will become unneeded eventually
	_ = strconv.Atoi
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := service.NewAdServletClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "Sender":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "Sender requires 1 args")
			flag.Usage()
		}
		arg10 := flag.Arg(1)
		mbTrans11 := thrift.NewTMemoryBufferLen(len(arg10))
		defer mbTrans11.Close()
		_, err12 := mbTrans11.WriteString(arg10)
		if err12 != nil {
			Usage()
			return
		}
		factory13 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt14 := factory13.GetProtocol(mbTrans11)
		argvalue0 := service.NewReqInfo()
		err15 := argvalue0.Read(jsProt14)
		if err15 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.Sender(value0))
		fmt.Print("\n")
		break
	case "Sender2":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "Sender2 requires 1 args")
			flag.Usage()
		}
		arg16 := flag.Arg(1)
		mbTrans17 := thrift.NewTMemoryBufferLen(len(arg16))
		defer mbTrans17.Close()
		_, err18 := mbTrans17.WriteString(arg16)
		if err18 != nil {
			Usage()
			return
		}
		factory19 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt20 := factory19.GetProtocol(mbTrans17)
		argvalue0 := service.NewReqInfo()
		err21 := argvalue0.Read(jsProt20)
		if err21 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.Sender2(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 26
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := servicessync.NewResourceManagerSyncClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "createResource":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CreateResource requires 2 args")
			flag.Usage()
		}
		argvalue0, err313 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err313 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg314 := flag.Arg(2)
		mbTrans315 := thrift.NewTMemoryBufferLen(len(arg314))
		defer mbTrans315.Close()
		_, err316 := mbTrans315.WriteString(arg314)
		if err316 != nil {
			Usage()
			return
		}
		factory317 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt318 := factory317.GetProtocol(mbTrans315)
		argvalue1 := servicessync.NewResource()
		err319 := argvalue1.Read(jsProt318)
		if err319 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.CreateResource(value0, value1))
		fmt.Print("\n")
		break
	case "getResource":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetResource requires 1 args")
			flag.Usage()
		}
		argvalue0, err320 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err320 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetResource(value0))
		fmt.Print("\n")
		break
	case "getResourceInfo":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetResourceInfo requires 1 args")
			flag.Usage()
		}
		argvalue0, err321 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err321 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetResourceInfo(value0))
		fmt.Print("\n")
		break
	case "updateResource":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "UpdateResource requires 2 args")
			flag.Usage()
		}
		arg322 := flag.Arg(1)
		mbTrans323 := thrift.NewTMemoryBufferLen(len(arg322))
		defer mbTrans323.Close()
		_, err324 := mbTrans323.WriteString(arg322)
		if err324 != nil {
			Usage()
			return
		}
		factory325 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt326 := factory325.GetProtocol(mbTrans323)
		argvalue0 := servicessync.NewResource()
		err327 := argvalue0.Read(jsProt326)
		if err327 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err328 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err328 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.UpdateResource(value0, value1))
		fmt.Print("\n")
		break
	case "deleteResource":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "DeleteResource requires 2 args")
			flag.Usage()
		}
		argvalue0, err329 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err329 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err330 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err330 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.DeleteResource(value0, value1))
		fmt.Print("\n")
		break
	case "shareResource":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "ShareResource requires 4 args")
			flag.Usage()
		}
		arg331 := flag.Arg(1)
		mbTrans332 := thrift.NewTMemoryBufferLen(len(arg331))
		defer mbTrans332.Close()
		_, err333 := mbTrans332.WriteString(arg331)
		if err333 != nil {
			Usage()
			return
		}
		factory334 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt335 := factory334.GetProtocol(mbTrans332)
		argvalue0 := servicessync.NewResource()
		err336 := argvalue0.Read(jsProt335)
		if err336 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg337 := flag.Arg(2)
		mbTrans338 := thrift.NewTMemoryBufferLen(len(arg337))
		defer mbTrans338.Close()
		_, err339 := mbTrans338.WriteString(arg337)
		if err339 != nil {
			Usage()
			return
		}
		factory340 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt341 := factory340.GetProtocol(mbTrans338)
		containerStruct1 := servicessync.NewShareResourceArgs()
		err342 := containerStruct1.ReadField2(jsProt341)
		if err342 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.ShareGroups
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := servicessync.Zone(tmp2)
		value2 := argvalue2
		argvalue3, err343 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err343 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.ShareResource(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getSharedResources":
		if flag.NArg()-1 != 8 {
			fmt.Fprintln(os.Stderr, "GetSharedResources requires 8 args")
			flag.Usage()
		}
		argvalue0, err344 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err344 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := servicessync.Zone(tmp1)
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := servicessync.ResourceType(tmp2)
		value2 := argvalue2
		argvalue3, err345 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err345 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		argvalue4, err346 := (strconv.ParseInt(flag.Arg(5), 10, 64))
		if err346 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		argvalue5, err347 := (strconv.ParseInt(flag.Arg(6), 10, 64))
		if err347 != nil {
			Usage()
			return
		}
		value5 := argvalue5
		argvalue6 := flag.Arg(7) == "true"
		value6 := argvalue6
		tmp7, err349 := (strconv.Atoi(flag.Arg(8)))
		if err349 != nil {
			Usage()
			return
		}
		argvalue7 := int32(tmp7)
		value7 := argvalue7
		fmt.Print(client.GetSharedResources(value0, value1, value2, value3, value4, value5, value6, value7))
		fmt.Print("\n")
		break
	case "cancelSharedResource":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "CancelSharedResource requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.CancelSharedResource(value0))
		fmt.Print("\n")
		break
	case "getUserResources":
		if flag.NArg()-1 != 7 {
			fmt.Fprintln(os.Stderr, "GetUserResources requires 7 args")
			flag.Usage()
		}
		argvalue0, err351 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err351 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := servicessync.ResourceType(tmp1)
		value1 := argvalue1
		argvalue2, err352 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err352 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		argvalue3, err353 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err353 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		argvalue4, err354 := (strconv.ParseInt(flag.Arg(5), 10, 64))
		if err354 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		argvalue5 := flag.Arg(6) == "true"
		value5 := argvalue5
		tmp6, err356 := (strconv.Atoi(flag.Arg(7)))
		if err356 != nil {
			Usage()
			return
		}
		argvalue6 := int32(tmp6)
		value6 := argvalue6
		fmt.Print(client.GetUserResources(value0, value1, value2, value3, value4, value5, value6))
		fmt.Print("\n")
		break
	case "addComment":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "AddComment requires 1 args")
			flag.Usage()
		}
		arg357 := flag.Arg(1)
		mbTrans358 := thrift.NewTMemoryBufferLen(len(arg357))
		defer mbTrans358.Close()
		_, err359 := mbTrans358.WriteString(arg357)
		if err359 != nil {
			Usage()
			return
		}
		factory360 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt361 := factory360.GetProtocol(mbTrans358)
		argvalue0 := servicessync.NewComment()
		err362 := argvalue0.Read(jsProt361)
		if err362 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.AddComment(value0))
		fmt.Print("\n")
		break
	case "deleteComment":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "DeleteComment requires 4 args")
			flag.Usage()
		}
		argvalue0, err363 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err363 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err364 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err364 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2, err365 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err365 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		argvalue3, err366 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err366 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.DeleteComment(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getComments":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "GetComments requires 6 args")
			flag.Usage()
		}
		argvalue0, err367 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err367 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err368 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err368 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2, err369 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err369 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		argvalue3, err370 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err370 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		argvalue4 := flag.Arg(5) == "true"
		value4 := argvalue4
		tmp5, err372 := (strconv.Atoi(flag.Arg(6)))
		if err372 != nil {
			Usage()
			return
		}
		argvalue5 := int32(tmp5)
		value5 := argvalue5
		fmt.Print(client.GetComments(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "operateThumb":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "OperateThumb requires 4 args")
			flag.Usage()
		}
		argvalue0, err373 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err373 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err374 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err374 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := servicessync.ThumbType(tmp2)
		value2 := argvalue2
		argvalue3, err375 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err375 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.OperateThumb(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getThumbs":
		if flag.NArg()-1 != 7 {
			fmt.Fprintln(os.Stderr, "GetThumbs requires 7 args")
			flag.Usage()
		}
		argvalue0, err376 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err376 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err377 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err377 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := servicessync.ThumbType(tmp2)
		value2 := argvalue2
		argvalue3, err378 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err378 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		argvalue4, err379 := (strconv.ParseInt(flag.Arg(5), 10, 64))
		if err379 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		argvalue5 := flag.Arg(6) == "true"
		value5 := argvalue5
		tmp6, err381 := (strconv.Atoi(flag.Arg(7)))
		if err381 != nil {
			Usage()
			return
		}
		argvalue6 := int32(tmp6)
		value6 := argvalue6
		fmt.Print(client.GetThumbs(value0, value1, value2, value3, value4, value5, value6))
		fmt.Print("\n")
		break
	case "getResources":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetResources requires 4 args")
			flag.Usage()
		}
		argvalue0, err382 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err382 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err383 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err383 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2 := flag.Arg(3) == "true"
		value2 := argvalue2
		tmp3, err385 := (strconv.Atoi(flag.Arg(4)))
		if err385 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		fmt.Print(client.GetResources(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getLatestResourcesByGid":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetLatestResourcesByGid requires 2 args")
			flag.Usage()
		}
		argvalue0, err386 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err386 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err387 := (strconv.Atoi(flag.Arg(2)))
		if err387 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		fmt.Print(client.GetLatestResourcesByGid(value0, value1))
		fmt.Print("\n")
		break
	case "getResourceForOperationPlatform":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetResourceForOperationPlatform requires 1 args")
			flag.Usage()
		}
		argvalue0, err388 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err388 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetResourceForOperationPlatform(value0))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 27
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := servicessync.NewSearchManagerSyncClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "searchPublicResources":
		if flag.NArg()-1 != 8 {
			fmt.Fprintln(os.Stderr, "SearchPublicResources requires 8 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := servicessync.SearchCategory(tmp1)
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := servicessync.ResourceType(tmp2)
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := servicessync.Zone(tmp3)
		value3 := argvalue3
		tmp4, err463 := (strconv.Atoi(flag.Arg(5)))
		if err463 != nil {
			Usage()
			return
		}
		argvalue4 := int32(tmp4)
		value4 := argvalue4
		tmp5, err464 := (strconv.Atoi(flag.Arg(6)))
		if err464 != nil {
			Usage()
			return
		}
		argvalue5 := int32(tmp5)
		value5 := argvalue5
		arg465 := flag.Arg(7)
		mbTrans466 := thrift.NewTMemoryBufferLen(len(arg465))
		defer mbTrans466.Close()
		_, err467 := mbTrans466.WriteString(arg465)
		if err467 != nil {
			Usage()
			return
		}
		factory468 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt469 := factory468.GetProtocol(mbTrans466)
		containerStruct6 := servicessync.NewSearchPublicResourcesArgs()
		err470 := containerStruct6.ReadField7(jsProt469)
		if err470 != nil {
			Usage()
			return
		}
		argvalue6 := containerStruct6.Sortlist
		value6 := argvalue6
		arg471 := flag.Arg(8)
		mbTrans472 := thrift.NewTMemoryBufferLen(len(arg471))
		defer mbTrans472.Close()
		_, err473 := mbTrans472.WriteString(arg471)
		if err473 != nil {
			Usage()
			return
		}
		factory474 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt475 := factory474.GetProtocol(mbTrans472)
		containerStruct7 := servicessync.NewSearchPublicResourcesArgs()
		err476 := containerStruct7.ReadField8(jsProt475)
		if err476 != nil {
			Usage()
			return
		}
		argvalue7 := containerStruct7.Filterlist
		value7 := argvalue7
		fmt.Print(client.SearchPublicResources(value0, value1, value2, value3, value4, value5, value6, value7))
		fmt.Print("\n")
		break
	case "searchGroupResources":
		if flag.NArg()-1 != 8 {
			fmt.Fprintln(os.Stderr, "SearchGroupResources requires 8 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1, err478 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err478 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := servicessync.ResourceType(tmp2)
		value2 := argvalue2
		tmp3, err := (strconv.Atoi(flag.Arg(4)))
		if err != nil {
			Usage()
			return
		}
		argvalue3 := servicessync.Zone(tmp3)
		value3 := argvalue3
		tmp4, err479 := (strconv.Atoi(flag.Arg(5)))
		if err479 != nil {
			Usage()
			return
		}
		argvalue4 := int32(tmp4)
		value4 := argvalue4
		tmp5, err480 := (strconv.Atoi(flag.Arg(6)))
		if err480 != nil {
			Usage()
			return
		}
		argvalue5 := int32(tmp5)
		value5 := argvalue5
		arg481 := flag.Arg(7)
		mbTrans482 := thrift.NewTMemoryBufferLen(len(arg481))
		defer mbTrans482.Close()
		_, err483 := mbTrans482.WriteString(arg481)
		if err483 != nil {
			Usage()
			return
		}
		factory484 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt485 := factory484.GetProtocol(mbTrans482)
		containerStruct6 := servicessync.NewSearchGroupResourcesArgs()
		err486 := containerStruct6.ReadField7(jsProt485)
		if err486 != nil {
			Usage()
			return
		}
		argvalue6 := containerStruct6.Sortlist
		value6 := argvalue6
		arg487 := flag.Arg(8)
		mbTrans488 := thrift.NewTMemoryBufferLen(len(arg487))
		defer mbTrans488.Close()
		_, err489 := mbTrans488.WriteString(arg487)
		if err489 != nil {
			Usage()
			return
		}
		factory490 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt491 := factory490.GetProtocol(mbTrans488)
		containerStruct7 := servicessync.NewSearchGroupResourcesArgs()
		err492 := containerStruct7.ReadField8(jsProt491)
		if err492 != nil {
			Usage()
			return
		}
		argvalue7 := containerStruct7.Filterlist
		value7 := argvalue7
		fmt.Print(client.SearchGroupResources(value0, value1, value2, value3, value4, value5, value6, value7))
		fmt.Print("\n")
		break
	case "searchGroup":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "SearchGroup requires 6 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := servicessync.GroupType(tmp1)
		value1 := argvalue1
		tmp2, err494 := (strconv.Atoi(flag.Arg(3)))
		if err494 != nil {
			Usage()
			return
		}
		argvalue2 := int32(tmp2)
		value2 := argvalue2
		tmp3, err495 := (strconv.Atoi(flag.Arg(4)))
		if err495 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		arg496 := flag.Arg(5)
		mbTrans497 := thrift.NewTMemoryBufferLen(len(arg496))
		defer mbTrans497.Close()
		_, err498 := mbTrans497.WriteString(arg496)
		if err498 != nil {
			Usage()
			return
		}
		factory499 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt500 := factory499.GetProtocol(mbTrans497)
		containerStruct4 := servicessync.NewSearchGroupArgs()
		err501 := containerStruct4.ReadField5(jsProt500)
		if err501 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Sortlist
		value4 := argvalue4
		arg502 := flag.Arg(6)
		mbTrans503 := thrift.NewTMemoryBufferLen(len(arg502))
		defer mbTrans503.Close()
		_, err504 := mbTrans503.WriteString(arg502)
		if err504 != nil {
			Usage()
			return
		}
		factory505 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt506 := factory505.GetProtocol(mbTrans503)
		containerStruct5 := servicessync.NewSearchGroupArgs()
		err507 := containerStruct5.ReadField6(jsProt506)
		if err507 != nil {
			Usage()
			return
		}
		argvalue5 := containerStruct5.Filterlist
		value5 := argvalue5
		fmt.Print(client.SearchGroup(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "searchUserBackend":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "SearchUserBackend requires 3 args")
			flag.Usage()
		}
		arg508 := flag.Arg(1)
		mbTrans509 := thrift.NewTMemoryBufferLen(len(arg508))
		defer mbTrans509.Close()
		_, err510 := mbTrans509.WriteString(arg508)
		if err510 != nil {
			Usage()
			return
		}
		factory511 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt512 := factory511.GetProtocol(mbTrans509)
		argvalue0 := servicessync.NewUserSearchInfo()
		err513 := argvalue0.Read(jsProt512)
		if err513 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg514 := flag.Arg(2)
		mbTrans515 := thrift.NewTMemoryBufferLen(len(arg514))
		defer mbTrans515.Close()
		_, err516 := mbTrans515.WriteString(arg514)
		if err516 != nil {
			Usage()
			return
		}
		factory517 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt518 := factory517.GetProtocol(mbTrans515)
		containerStruct1 := servicessync.NewSearchUserBackendArgs()
		err519 := containerStruct1.ReadField2(jsProt518)
		if err519 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Sortlist
		value1 := argvalue1
		arg520 := flag.Arg(3)
		mbTrans521 := thrift.NewTMemoryBufferLen(len(arg520))
		defer mbTrans521.Close()
		_, err522 := mbTrans521.WriteString(arg520)
		if err522 != nil {
			Usage()
			return
		}
		factory523 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt524 := factory523.GetProtocol(mbTrans521)
		containerStruct2 := servicessync.NewSearchUserBackendArgs()
		err525 := containerStruct2.ReadField3(jsProt524)
		if err525 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Filterlist
		value2 := argvalue2
		fmt.Print(client.SearchUserBackend(value0, value1, value2))
		fmt.Print("\n")
		break
	case "searchResourceByTag":
		if flag.NArg()-1 != 7 {
			fmt.Fprintln(os.Stderr, "SearchResourceByTag requires 7 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := servicessync.ResourceType(tmp1)
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := servicessync.Zone(tmp2)
		value2 := argvalue2
		tmp3, err527 := (strconv.Atoi(flag.Arg(4)))
		if err527 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		tmp4, err528 := (strconv.Atoi(flag.Arg(5)))
		if err528 != nil {
			Usage()
			return
		}
		argvalue4 := int32(tmp4)
		value4 := argvalue4
		arg529 := flag.Arg(6)
		mbTrans530 := thrift.NewTMemoryBufferLen(len(arg529))
		defer mbTrans530.Close()
		_, err531 := mbTrans530.WriteString(arg529)
		if err531 != nil {
			Usage()
			return
		}
		factory532 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt533 := factory532.GetProtocol(mbTrans530)
		containerStruct5 := servicessync.NewSearchResourceByTagArgs()
		err534 := containerStruct5.ReadField6(jsProt533)
		if err534 != nil {
			Usage()
			return
		}
		argvalue5 := containerStruct5.Sortlist
		value5 := argvalue5
		arg535 := flag.Arg(7)
		mbTrans536 := thrift.NewTMemoryBufferLen(len(arg535))
		defer mbTrans536.Close()
		_, err537 := mbTrans536.WriteString(arg535)
		if err537 != nil {
			Usage()
			return
		}
		factory538 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt539 := factory538.GetProtocol(mbTrans536)
		containerStruct6 := servicessync.NewSearchResourceByTagArgs()
		err540 := containerStruct6.ReadField7(jsProt539)
		if err540 != nil {
			Usage()
			return
		}
		argvalue6 := containerStruct6.Filterlist
		value6 := argvalue6
		fmt.Print(client.SearchResourceByTag(value0, value1, value2, value3, value4, value5, value6))
		fmt.Print("\n")
		break
	case "searchGroupIds":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "SearchGroupIds requires 4 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := servicessync.Zone(tmp1)
		value1 := argvalue1
		arg542 := flag.Arg(3)
		mbTrans543 := thrift.NewTMemoryBufferLen(len(arg542))
		defer mbTrans543.Close()
		_, err544 := mbTrans543.WriteString(arg542)
		if err544 != nil {
			Usage()
			return
		}
		factory545 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt546 := factory545.GetProtocol(mbTrans543)
		containerStruct2 := servicessync.NewSearchGroupIdsArgs()
		err547 := containerStruct2.ReadField3(jsProt546)
		if err547 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Sortlist
		value2 := argvalue2
		arg548 := flag.Arg(4)
		mbTrans549 := thrift.NewTMemoryBufferLen(len(arg548))
		defer mbTrans549.Close()
		_, err550 := mbTrans549.WriteString(arg548)
		if err550 != nil {
			Usage()
			return
		}
		factory551 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt552 := factory551.GetProtocol(mbTrans549)
		containerStruct3 := servicessync.NewSearchGroupIdsArgs()
		err553 := containerStruct3.ReadField4(jsProt552)
		if err553 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Filterlist
		value3 := argvalue3
		fmt.Print(client.SearchGroupIds(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 28
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := services.NewUserSvcClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "createUser":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "CreateUser requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.CreateUser(value0))
		fmt.Print("\n")
		break
	case "getMe":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetMe requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetMe(value0))
		fmt.Print("\n")
		break
	case "getUserById":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetUserById requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.GetUserById(value0, value1))
		fmt.Print("\n")
		break
	case "getFriends":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetFriends requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetFriends(value0))
		fmt.Print("\n")
		break
	case "getFriendRequests":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetFriendRequests requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetFriendRequests(value0))
		fmt.Print("\n")
		break
	case "acceptFriendRequest":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "AcceptFriendRequest requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.AcceptFriendRequest(value0, value1))
		fmt.Print("\n")
		break
	case "declineFriendRequest":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "DeclineFriendRequest requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.DeclineFriendRequest(value0, value1))
		fmt.Print("\n")
		break
	case "sendFriendRequest":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "SendFriendRequest requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.SendFriendRequest(value0, value1))
		fmt.Print("\n")
		break
	case "setProfile":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "SetProfile requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg114 := flag.Arg(2)
		mbTrans115 := thrift.NewTMemoryBufferLen(len(arg114))
		defer mbTrans115.Close()
		_, err116 := mbTrans115.WriteString(arg114)
		if err116 != nil {
			Usage()
			return
		}
		factory117 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt118 := factory117.GetProtocol(mbTrans115)
		argvalue1 := services.NewProfile()
		err119 := argvalue1.Read(jsProt118)
		if err119 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.SetProfile(value0, value1))
		fmt.Print("\n")
		break
	case "requestToken":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "RequestToken requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.RequestToken(value0, value1))
		fmt.Print("\n")
		break
	case "setAdmin":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "SetAdmin requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		argvalue2 := flag.Arg(3) == "true"
		value2 := argvalue2
		fmt.Print(client.SetAdmin(value0, value1, value2))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 29
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := user.NewUserSvcClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "create":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "Create requires 1 args")
			flag.Usage()
		}
		arg15 := flag.Arg(1)
		mbTrans16 := thrift.NewTMemoryBufferLen(len(arg15))
		defer mbTrans16.Close()
		_, err17 := mbTrans16.WriteString(arg15)
		if err17 != nil {
			Usage()
			return
		}
		factory18 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt19 := factory18.GetProtocol(mbTrans16)
		argvalue0 := user.NewUser()
		err20 := argvalue0.Read(jsProt19)
		if err20 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.Create(value0))
		fmt.Print("\n")
		break
	case "read":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "Read requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.Read(value0))
		fmt.Print("\n")
		break
	case "update":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "Update requires 1 args")
			flag.Usage()
		}
		arg22 := flag.Arg(1)
		mbTrans23 := thrift.NewTMemoryBufferLen(len(arg22))
		defer mbTrans23.Close()
		_, err24 := mbTrans23.WriteString(arg22)
		if err24 != nil {
			Usage()
			return
		}
		factory25 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt26 := factory25.GetProtocol(mbTrans23)
		argvalue0 := user.NewUser()
		err27 := argvalue0.Read(jsProt26)
		if err27 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.Update(value0))
		fmt.Print("\n")
		break
	case "destroy":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "Destroy requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.Destroy(value0))
		fmt.Print("\n")
		break
	case "fetch":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "Fetch requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.Fetch())
		fmt.Print("\n")
		break
	case "reset":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "Reset requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.Reset())
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
Ejemplo n.º 30
0
func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	var parsedUrl url.URL
	var trans thrift.TTransport
	_ = strconv.Atoi
	_ = math.Abs
	flag.Usage = Usage
	flag.StringVar(&host, "h", "localhost", "Specify host and port")
	flag.IntVar(&port, "p", 9090, "Specify port")
	flag.StringVar(&protocol, "P", "binary", "Specify the protocol (binary, compact, simplejson, json)")
	flag.StringVar(&urlString, "u", "", "Specify the url")
	flag.BoolVar(&framed, "framed", false, "Use framed transport")
	flag.BoolVar(&useHttp, "http", false, "Use http")
	flag.Parse()

	if len(urlString) > 0 {
		parsedUrl, err := url.Parse(urlString)
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
		host = parsedUrl.Host
		useHttp = len(parsedUrl.Scheme) <= 0 || parsedUrl.Scheme == "http"
	} else if useHttp {
		_, err := url.Parse(fmt.Sprint("http://", host, ":", port))
		if err != nil {
			fmt.Fprintln(os.Stderr, "Error parsing URL: ", err)
			flag.Usage()
		}
	}

	cmd := flag.Arg(0)
	var err error
	if useHttp {
		trans, err = thrift.NewTHttpClient(parsedUrl.String())
	} else {
		portStr := fmt.Sprint(port)
		if strings.Contains(host, ":") {
			host, portStr, err = net.SplitHostPort(host)
			if err != nil {
				fmt.Fprintln(os.Stderr, "error with host:", err)
				os.Exit(1)
			}
		}
		trans, err = thrift.NewTSocket(net.JoinHostPort(host, portStr))
		if err != nil {
			fmt.Fprintln(os.Stderr, "error resolving address:", err)
			os.Exit(1)
		}
		if framed {
			trans = thrift.NewTFramedTransport(trans)
		}
	}
	if err != nil {
		fmt.Fprintln(os.Stderr, "Error creating transport", err)
		os.Exit(1)
	}
	defer trans.Close()
	var protocolFactory thrift.TProtocolFactory
	switch protocol {
	case "compact":
		protocolFactory = thrift.NewTCompactProtocolFactory()
		break
	case "simplejson":
		protocolFactory = thrift.NewTSimpleJSONProtocolFactory()
		break
	case "json":
		protocolFactory = thrift.NewTJSONProtocolFactory()
		break
	case "binary", "":
		protocolFactory = thrift.NewTBinaryProtocolFactoryDefault()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid protocol specified: ", protocol)
		Usage()
		os.Exit(1)
	}
	client := hbase.NewHbaseClientFactory(trans, protocolFactory)
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "enableTable":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "EnableTable requires 1 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Bytes(argvalue0)
		fmt.Print(client.EnableTable(value0))
		fmt.Print("\n")
		break
	case "disableTable":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "DisableTable requires 1 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Bytes(argvalue0)
		fmt.Print(client.DisableTable(value0))
		fmt.Print("\n")
		break
	case "isTableEnabled":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "IsTableEnabled requires 1 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Bytes(argvalue0)
		fmt.Print(client.IsTableEnabled(value0))
		fmt.Print("\n")
		break
	case "compact":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "Compact requires 1 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Bytes(argvalue0)
		fmt.Print(client.Compact(value0))
		fmt.Print("\n")
		break
	case "majorCompact":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "MajorCompact requires 1 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Bytes(argvalue0)
		fmt.Print(client.MajorCompact(value0))
		fmt.Print("\n")
		break
	case "getTableNames":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "GetTableNames requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.GetTableNames())
		fmt.Print("\n")
		break
	case "getColumnDescriptors":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetColumnDescriptors requires 1 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		fmt.Print(client.GetColumnDescriptors(value0))
		fmt.Print("\n")
		break
	case "getTableRegions":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetTableRegions requires 1 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		fmt.Print(client.GetTableRegions(value0))
		fmt.Print("\n")
		break
	case "createTable":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CreateTable requires 2 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		arg194 := flag.Arg(2)
		mbTrans195 := thrift.NewTMemoryBufferLen(len(arg194))
		defer mbTrans195.Close()
		_, err196 := mbTrans195.WriteString(arg194)
		if err196 != nil {
			Usage()
			return
		}
		factory197 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt198 := factory197.GetProtocol(mbTrans195)
		containerStruct1 := hbase.NewCreateTableArgs()
		err199 := containerStruct1.ReadField2(jsProt198)
		if err199 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.ColumnFamilies
		value1 := argvalue1
		fmt.Print(client.CreateTable(value0, value1))
		fmt.Print("\n")
		break
	case "deleteTable":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "DeleteTable requires 1 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		fmt.Print(client.DeleteTable(value0))
		fmt.Print("\n")
		break
	case "get":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "Get requires 4 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		argvalue2 := []byte(flag.Arg(3))
		value2 := hbase.Text(argvalue2)
		arg204 := flag.Arg(4)
		mbTrans205 := thrift.NewTMemoryBufferLen(len(arg204))
		defer mbTrans205.Close()
		_, err206 := mbTrans205.WriteString(arg204)
		if err206 != nil {
			Usage()
			return
		}
		factory207 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt208 := factory207.GetProtocol(mbTrans205)
		containerStruct3 := hbase.NewGetArgs()
		err209 := containerStruct3.ReadField4(jsProt208)
		if err209 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.Get(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getVer":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "GetVer requires 5 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		argvalue2 := []byte(flag.Arg(3))
		value2 := hbase.Text(argvalue2)
		tmp3, err213 := (strconv.Atoi(flag.Arg(4)))
		if err213 != nil {
			Usage()
			return
		}
		argvalue3 := int32(tmp3)
		value3 := argvalue3
		arg214 := flag.Arg(5)
		mbTrans215 := thrift.NewTMemoryBufferLen(len(arg214))
		defer mbTrans215.Close()
		_, err216 := mbTrans215.WriteString(arg214)
		if err216 != nil {
			Usage()
			return
		}
		factory217 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt218 := factory217.GetProtocol(mbTrans215)
		containerStruct4 := hbase.NewGetVerArgs()
		err219 := containerStruct4.ReadField5(jsProt218)
		if err219 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Attributes
		value4 := argvalue4
		fmt.Print(client.GetVer(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "getVerTs":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "GetVerTs requires 6 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		argvalue2 := []byte(flag.Arg(3))
		value2 := hbase.Text(argvalue2)
		argvalue3, err223 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err223 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		tmp4, err224 := (strconv.Atoi(flag.Arg(5)))
		if err224 != nil {
			Usage()
			return
		}
		argvalue4 := int32(tmp4)
		value4 := argvalue4
		arg225 := flag.Arg(6)
		mbTrans226 := thrift.NewTMemoryBufferLen(len(arg225))
		defer mbTrans226.Close()
		_, err227 := mbTrans226.WriteString(arg225)
		if err227 != nil {
			Usage()
			return
		}
		factory228 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt229 := factory228.GetProtocol(mbTrans226)
		containerStruct5 := hbase.NewGetVerTsArgs()
		err230 := containerStruct5.ReadField6(jsProt229)
		if err230 != nil {
			Usage()
			return
		}
		argvalue5 := containerStruct5.Attributes
		value5 := argvalue5
		fmt.Print(client.GetVerTs(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "getRow":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "GetRow requires 3 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		arg233 := flag.Arg(3)
		mbTrans234 := thrift.NewTMemoryBufferLen(len(arg233))
		defer mbTrans234.Close()
		_, err235 := mbTrans234.WriteString(arg233)
		if err235 != nil {
			Usage()
			return
		}
		factory236 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt237 := factory236.GetProtocol(mbTrans234)
		containerStruct2 := hbase.NewGetRowArgs()
		err238 := containerStruct2.ReadField3(jsProt237)
		if err238 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Attributes
		value2 := argvalue2
		fmt.Print(client.GetRow(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getRowWithColumns":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetRowWithColumns requires 4 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		arg241 := flag.Arg(3)
		mbTrans242 := thrift.NewTMemoryBufferLen(len(arg241))
		defer mbTrans242.Close()
		_, err243 := mbTrans242.WriteString(arg241)
		if err243 != nil {
			Usage()
			return
		}
		factory244 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt245 := factory244.GetProtocol(mbTrans242)
		containerStruct2 := hbase.NewGetRowWithColumnsArgs()
		err246 := containerStruct2.ReadField3(jsProt245)
		if err246 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		arg247 := flag.Arg(4)
		mbTrans248 := thrift.NewTMemoryBufferLen(len(arg247))
		defer mbTrans248.Close()
		_, err249 := mbTrans248.WriteString(arg247)
		if err249 != nil {
			Usage()
			return
		}
		factory250 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt251 := factory250.GetProtocol(mbTrans248)
		containerStruct3 := hbase.NewGetRowWithColumnsArgs()
		err252 := containerStruct3.ReadField4(jsProt251)
		if err252 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.GetRowWithColumns(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getRowTs":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetRowTs requires 4 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		argvalue2, err255 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err255 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg256 := flag.Arg(4)
		mbTrans257 := thrift.NewTMemoryBufferLen(len(arg256))
		defer mbTrans257.Close()
		_, err258 := mbTrans257.WriteString(arg256)
		if err258 != nil {
			Usage()
			return
		}
		factory259 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt260 := factory259.GetProtocol(mbTrans257)
		containerStruct3 := hbase.NewGetRowTsArgs()
		err261 := containerStruct3.ReadField4(jsProt260)
		if err261 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.GetRowTs(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getRowWithColumnsTs":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "GetRowWithColumnsTs requires 5 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		arg264 := flag.Arg(3)
		mbTrans265 := thrift.NewTMemoryBufferLen(len(arg264))
		defer mbTrans265.Close()
		_, err266 := mbTrans265.WriteString(arg264)
		if err266 != nil {
			Usage()
			return
		}
		factory267 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt268 := factory267.GetProtocol(mbTrans265)
		containerStruct2 := hbase.NewGetRowWithColumnsTsArgs()
		err269 := containerStruct2.ReadField3(jsProt268)
		if err269 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		argvalue3, err270 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err270 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		arg271 := flag.Arg(5)
		mbTrans272 := thrift.NewTMemoryBufferLen(len(arg271))
		defer mbTrans272.Close()
		_, err273 := mbTrans272.WriteString(arg271)
		if err273 != nil {
			Usage()
			return
		}
		factory274 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt275 := factory274.GetProtocol(mbTrans272)
		containerStruct4 := hbase.NewGetRowWithColumnsTsArgs()
		err276 := containerStruct4.ReadField5(jsProt275)
		if err276 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Attributes
		value4 := argvalue4
		fmt.Print(client.GetRowWithColumnsTs(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "getRows":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "GetRows requires 3 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		arg278 := flag.Arg(2)
		mbTrans279 := thrift.NewTMemoryBufferLen(len(arg278))
		defer mbTrans279.Close()
		_, err280 := mbTrans279.WriteString(arg278)
		if err280 != nil {
			Usage()
			return
		}
		factory281 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt282 := factory281.GetProtocol(mbTrans279)
		containerStruct1 := hbase.NewGetRowsArgs()
		err283 := containerStruct1.ReadField2(jsProt282)
		if err283 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Rows
		value1 := argvalue1
		arg284 := flag.Arg(3)
		mbTrans285 := thrift.NewTMemoryBufferLen(len(arg284))
		defer mbTrans285.Close()
		_, err286 := mbTrans285.WriteString(arg284)
		if err286 != nil {
			Usage()
			return
		}
		factory287 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt288 := factory287.GetProtocol(mbTrans285)
		containerStruct2 := hbase.NewGetRowsArgs()
		err289 := containerStruct2.ReadField3(jsProt288)
		if err289 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Attributes
		value2 := argvalue2
		fmt.Print(client.GetRows(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getRowsWithColumns":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetRowsWithColumns requires 4 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		arg291 := flag.Arg(2)
		mbTrans292 := thrift.NewTMemoryBufferLen(len(arg291))
		defer mbTrans292.Close()
		_, err293 := mbTrans292.WriteString(arg291)
		if err293 != nil {
			Usage()
			return
		}
		factory294 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt295 := factory294.GetProtocol(mbTrans292)
		containerStruct1 := hbase.NewGetRowsWithColumnsArgs()
		err296 := containerStruct1.ReadField2(jsProt295)
		if err296 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Rows
		value1 := argvalue1
		arg297 := flag.Arg(3)
		mbTrans298 := thrift.NewTMemoryBufferLen(len(arg297))
		defer mbTrans298.Close()
		_, err299 := mbTrans298.WriteString(arg297)
		if err299 != nil {
			Usage()
			return
		}
		factory300 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt301 := factory300.GetProtocol(mbTrans298)
		containerStruct2 := hbase.NewGetRowsWithColumnsArgs()
		err302 := containerStruct2.ReadField3(jsProt301)
		if err302 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		arg303 := flag.Arg(4)
		mbTrans304 := thrift.NewTMemoryBufferLen(len(arg303))
		defer mbTrans304.Close()
		_, err305 := mbTrans304.WriteString(arg303)
		if err305 != nil {
			Usage()
			return
		}
		factory306 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt307 := factory306.GetProtocol(mbTrans304)
		containerStruct3 := hbase.NewGetRowsWithColumnsArgs()
		err308 := containerStruct3.ReadField4(jsProt307)
		if err308 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.GetRowsWithColumns(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getRowsTs":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetRowsTs requires 4 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		arg310 := flag.Arg(2)
		mbTrans311 := thrift.NewTMemoryBufferLen(len(arg310))
		defer mbTrans311.Close()
		_, err312 := mbTrans311.WriteString(arg310)
		if err312 != nil {
			Usage()
			return
		}
		factory313 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt314 := factory313.GetProtocol(mbTrans311)
		containerStruct1 := hbase.NewGetRowsTsArgs()
		err315 := containerStruct1.ReadField2(jsProt314)
		if err315 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Rows
		value1 := argvalue1
		argvalue2, err316 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err316 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg317 := flag.Arg(4)
		mbTrans318 := thrift.NewTMemoryBufferLen(len(arg317))
		defer mbTrans318.Close()
		_, err319 := mbTrans318.WriteString(arg317)
		if err319 != nil {
			Usage()
			return
		}
		factory320 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt321 := factory320.GetProtocol(mbTrans318)
		containerStruct3 := hbase.NewGetRowsTsArgs()
		err322 := containerStruct3.ReadField4(jsProt321)
		if err322 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.GetRowsTs(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getRowsWithColumnsTs":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "GetRowsWithColumnsTs requires 5 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		arg324 := flag.Arg(2)
		mbTrans325 := thrift.NewTMemoryBufferLen(len(arg324))
		defer mbTrans325.Close()
		_, err326 := mbTrans325.WriteString(arg324)
		if err326 != nil {
			Usage()
			return
		}
		factory327 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt328 := factory327.GetProtocol(mbTrans325)
		containerStruct1 := hbase.NewGetRowsWithColumnsTsArgs()
		err329 := containerStruct1.ReadField2(jsProt328)
		if err329 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Rows
		value1 := argvalue1
		arg330 := flag.Arg(3)
		mbTrans331 := thrift.NewTMemoryBufferLen(len(arg330))
		defer mbTrans331.Close()
		_, err332 := mbTrans331.WriteString(arg330)
		if err332 != nil {
			Usage()
			return
		}
		factory333 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt334 := factory333.GetProtocol(mbTrans331)
		containerStruct2 := hbase.NewGetRowsWithColumnsTsArgs()
		err335 := containerStruct2.ReadField3(jsProt334)
		if err335 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		argvalue3, err336 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err336 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		arg337 := flag.Arg(5)
		mbTrans338 := thrift.NewTMemoryBufferLen(len(arg337))
		defer mbTrans338.Close()
		_, err339 := mbTrans338.WriteString(arg337)
		if err339 != nil {
			Usage()
			return
		}
		factory340 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt341 := factory340.GetProtocol(mbTrans338)
		containerStruct4 := hbase.NewGetRowsWithColumnsTsArgs()
		err342 := containerStruct4.ReadField5(jsProt341)
		if err342 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Attributes
		value4 := argvalue4
		fmt.Print(client.GetRowsWithColumnsTs(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "mutateRow":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "MutateRow requires 4 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		arg345 := flag.Arg(3)
		mbTrans346 := thrift.NewTMemoryBufferLen(len(arg345))
		defer mbTrans346.Close()
		_, err347 := mbTrans346.WriteString(arg345)
		if err347 != nil {
			Usage()
			return
		}
		factory348 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt349 := factory348.GetProtocol(mbTrans346)
		containerStruct2 := hbase.NewMutateRowArgs()
		err350 := containerStruct2.ReadField3(jsProt349)
		if err350 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Mutations
		value2 := argvalue2
		arg351 := flag.Arg(4)
		mbTrans352 := thrift.NewTMemoryBufferLen(len(arg351))
		defer mbTrans352.Close()
		_, err353 := mbTrans352.WriteString(arg351)
		if err353 != nil {
			Usage()
			return
		}
		factory354 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt355 := factory354.GetProtocol(mbTrans352)
		containerStruct3 := hbase.NewMutateRowArgs()
		err356 := containerStruct3.ReadField4(jsProt355)
		if err356 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.MutateRow(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "mutateRowTs":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "MutateRowTs requires 5 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		arg359 := flag.Arg(3)
		mbTrans360 := thrift.NewTMemoryBufferLen(len(arg359))
		defer mbTrans360.Close()
		_, err361 := mbTrans360.WriteString(arg359)
		if err361 != nil {
			Usage()
			return
		}
		factory362 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt363 := factory362.GetProtocol(mbTrans360)
		containerStruct2 := hbase.NewMutateRowTsArgs()
		err364 := containerStruct2.ReadField3(jsProt363)
		if err364 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Mutations
		value2 := argvalue2
		argvalue3, err365 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err365 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		arg366 := flag.Arg(5)
		mbTrans367 := thrift.NewTMemoryBufferLen(len(arg366))
		defer mbTrans367.Close()
		_, err368 := mbTrans367.WriteString(arg366)
		if err368 != nil {
			Usage()
			return
		}
		factory369 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt370 := factory369.GetProtocol(mbTrans367)
		containerStruct4 := hbase.NewMutateRowTsArgs()
		err371 := containerStruct4.ReadField5(jsProt370)
		if err371 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Attributes
		value4 := argvalue4
		fmt.Print(client.MutateRowTs(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "mutateRows":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "MutateRows requires 3 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		arg373 := flag.Arg(2)
		mbTrans374 := thrift.NewTMemoryBufferLen(len(arg373))
		defer mbTrans374.Close()
		_, err375 := mbTrans374.WriteString(arg373)
		if err375 != nil {
			Usage()
			return
		}
		factory376 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt377 := factory376.GetProtocol(mbTrans374)
		containerStruct1 := hbase.NewMutateRowsArgs()
		err378 := containerStruct1.ReadField2(jsProt377)
		if err378 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.RowBatches
		value1 := argvalue1
		arg379 := flag.Arg(3)
		mbTrans380 := thrift.NewTMemoryBufferLen(len(arg379))
		defer mbTrans380.Close()
		_, err381 := mbTrans380.WriteString(arg379)
		if err381 != nil {
			Usage()
			return
		}
		factory382 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt383 := factory382.GetProtocol(mbTrans380)
		containerStruct2 := hbase.NewMutateRowsArgs()
		err384 := containerStruct2.ReadField3(jsProt383)
		if err384 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Attributes
		value2 := argvalue2
		fmt.Print(client.MutateRows(value0, value1, value2))
		fmt.Print("\n")
		break
	case "mutateRowsTs":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "MutateRowsTs requires 4 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		arg386 := flag.Arg(2)
		mbTrans387 := thrift.NewTMemoryBufferLen(len(arg386))
		defer mbTrans387.Close()
		_, err388 := mbTrans387.WriteString(arg386)
		if err388 != nil {
			Usage()
			return
		}
		factory389 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt390 := factory389.GetProtocol(mbTrans387)
		containerStruct1 := hbase.NewMutateRowsTsArgs()
		err391 := containerStruct1.ReadField2(jsProt390)
		if err391 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.RowBatches
		value1 := argvalue1
		argvalue2, err392 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err392 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg393 := flag.Arg(4)
		mbTrans394 := thrift.NewTMemoryBufferLen(len(arg393))
		defer mbTrans394.Close()
		_, err395 := mbTrans394.WriteString(arg393)
		if err395 != nil {
			Usage()
			return
		}
		factory396 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt397 := factory396.GetProtocol(mbTrans394)
		containerStruct3 := hbase.NewMutateRowsTsArgs()
		err398 := containerStruct3.ReadField4(jsProt397)
		if err398 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.MutateRowsTs(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "atomicIncrement":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "AtomicIncrement requires 4 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		argvalue2 := []byte(flag.Arg(3))
		value2 := hbase.Text(argvalue2)
		argvalue3, err402 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err402 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.AtomicIncrement(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "deleteAll":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "DeleteAll requires 4 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		argvalue2 := []byte(flag.Arg(3))
		value2 := hbase.Text(argvalue2)
		arg406 := flag.Arg(4)
		mbTrans407 := thrift.NewTMemoryBufferLen(len(arg406))
		defer mbTrans407.Close()
		_, err408 := mbTrans407.WriteString(arg406)
		if err408 != nil {
			Usage()
			return
		}
		factory409 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt410 := factory409.GetProtocol(mbTrans407)
		containerStruct3 := hbase.NewDeleteAllArgs()
		err411 := containerStruct3.ReadField4(jsProt410)
		if err411 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.DeleteAll(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "deleteAllTs":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "DeleteAllTs requires 5 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		argvalue2 := []byte(flag.Arg(3))
		value2 := hbase.Text(argvalue2)
		argvalue3, err415 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err415 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		arg416 := flag.Arg(5)
		mbTrans417 := thrift.NewTMemoryBufferLen(len(arg416))
		defer mbTrans417.Close()
		_, err418 := mbTrans417.WriteString(arg416)
		if err418 != nil {
			Usage()
			return
		}
		factory419 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt420 := factory419.GetProtocol(mbTrans417)
		containerStruct4 := hbase.NewDeleteAllTsArgs()
		err421 := containerStruct4.ReadField5(jsProt420)
		if err421 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Attributes
		value4 := argvalue4
		fmt.Print(client.DeleteAllTs(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "deleteAllRow":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "DeleteAllRow requires 3 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		arg424 := flag.Arg(3)
		mbTrans425 := thrift.NewTMemoryBufferLen(len(arg424))
		defer mbTrans425.Close()
		_, err426 := mbTrans425.WriteString(arg424)
		if err426 != nil {
			Usage()
			return
		}
		factory427 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt428 := factory427.GetProtocol(mbTrans425)
		containerStruct2 := hbase.NewDeleteAllRowArgs()
		err429 := containerStruct2.ReadField3(jsProt428)
		if err429 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Attributes
		value2 := argvalue2
		fmt.Print(client.DeleteAllRow(value0, value1, value2))
		fmt.Print("\n")
		break
	case "increment":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "Increment requires 1 args")
			flag.Usage()
		}
		arg430 := flag.Arg(1)
		mbTrans431 := thrift.NewTMemoryBufferLen(len(arg430))
		defer mbTrans431.Close()
		_, err432 := mbTrans431.WriteString(arg430)
		if err432 != nil {
			Usage()
			return
		}
		factory433 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt434 := factory433.GetProtocol(mbTrans431)
		argvalue0 := hbase.NewTIncrement()
		err435 := argvalue0.Read(jsProt434)
		if err435 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.Increment(value0))
		fmt.Print("\n")
		break
	case "incrementRows":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "IncrementRows requires 1 args")
			flag.Usage()
		}
		arg436 := flag.Arg(1)
		mbTrans437 := thrift.NewTMemoryBufferLen(len(arg436))
		defer mbTrans437.Close()
		_, err438 := mbTrans437.WriteString(arg436)
		if err438 != nil {
			Usage()
			return
		}
		factory439 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt440 := factory439.GetProtocol(mbTrans437)
		containerStruct0 := hbase.NewIncrementRowsArgs()
		err441 := containerStruct0.ReadField1(jsProt440)
		if err441 != nil {
			Usage()
			return
		}
		argvalue0 := containerStruct0.Increments
		value0 := argvalue0
		fmt.Print(client.IncrementRows(value0))
		fmt.Print("\n")
		break
	case "deleteAllRowTs":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "DeleteAllRowTs requires 4 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		argvalue2, err444 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err444 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg445 := flag.Arg(4)
		mbTrans446 := thrift.NewTMemoryBufferLen(len(arg445))
		defer mbTrans446.Close()
		_, err447 := mbTrans446.WriteString(arg445)
		if err447 != nil {
			Usage()
			return
		}
		factory448 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt449 := factory448.GetProtocol(mbTrans446)
		containerStruct3 := hbase.NewDeleteAllRowTsArgs()
		err450 := containerStruct3.ReadField4(jsProt449)
		if err450 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.DeleteAllRowTs(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "scannerOpenWithScan":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "ScannerOpenWithScan requires 3 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		arg452 := flag.Arg(2)
		mbTrans453 := thrift.NewTMemoryBufferLen(len(arg452))
		defer mbTrans453.Close()
		_, err454 := mbTrans453.WriteString(arg452)
		if err454 != nil {
			Usage()
			return
		}
		factory455 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt456 := factory455.GetProtocol(mbTrans453)
		argvalue1 := hbase.NewTScan()
		err457 := argvalue1.Read(jsProt456)
		if err457 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg458 := flag.Arg(3)
		mbTrans459 := thrift.NewTMemoryBufferLen(len(arg458))
		defer mbTrans459.Close()
		_, err460 := mbTrans459.WriteString(arg458)
		if err460 != nil {
			Usage()
			return
		}
		factory461 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt462 := factory461.GetProtocol(mbTrans459)
		containerStruct2 := hbase.NewScannerOpenWithScanArgs()
		err463 := containerStruct2.ReadField3(jsProt462)
		if err463 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Attributes
		value2 := argvalue2
		fmt.Print(client.ScannerOpenWithScan(value0, value1, value2))
		fmt.Print("\n")
		break
	case "scannerOpen":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "ScannerOpen requires 4 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		arg466 := flag.Arg(3)
		mbTrans467 := thrift.NewTMemoryBufferLen(len(arg466))
		defer mbTrans467.Close()
		_, err468 := mbTrans467.WriteString(arg466)
		if err468 != nil {
			Usage()
			return
		}
		factory469 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt470 := factory469.GetProtocol(mbTrans467)
		containerStruct2 := hbase.NewScannerOpenArgs()
		err471 := containerStruct2.ReadField3(jsProt470)
		if err471 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		arg472 := flag.Arg(4)
		mbTrans473 := thrift.NewTMemoryBufferLen(len(arg472))
		defer mbTrans473.Close()
		_, err474 := mbTrans473.WriteString(arg472)
		if err474 != nil {
			Usage()
			return
		}
		factory475 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt476 := factory475.GetProtocol(mbTrans473)
		containerStruct3 := hbase.NewScannerOpenArgs()
		err477 := containerStruct3.ReadField4(jsProt476)
		if err477 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.ScannerOpen(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "scannerOpenWithStop":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "ScannerOpenWithStop requires 5 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		argvalue2 := []byte(flag.Arg(3))
		value2 := hbase.Text(argvalue2)
		arg481 := flag.Arg(4)
		mbTrans482 := thrift.NewTMemoryBufferLen(len(arg481))
		defer mbTrans482.Close()
		_, err483 := mbTrans482.WriteString(arg481)
		if err483 != nil {
			Usage()
			return
		}
		factory484 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt485 := factory484.GetProtocol(mbTrans482)
		containerStruct3 := hbase.NewScannerOpenWithStopArgs()
		err486 := containerStruct3.ReadField4(jsProt485)
		if err486 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Columns
		value3 := argvalue3
		arg487 := flag.Arg(5)
		mbTrans488 := thrift.NewTMemoryBufferLen(len(arg487))
		defer mbTrans488.Close()
		_, err489 := mbTrans488.WriteString(arg487)
		if err489 != nil {
			Usage()
			return
		}
		factory490 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt491 := factory490.GetProtocol(mbTrans488)
		containerStruct4 := hbase.NewScannerOpenWithStopArgs()
		err492 := containerStruct4.ReadField5(jsProt491)
		if err492 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Attributes
		value4 := argvalue4
		fmt.Print(client.ScannerOpenWithStop(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "scannerOpenWithPrefix":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "ScannerOpenWithPrefix requires 4 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		arg495 := flag.Arg(3)
		mbTrans496 := thrift.NewTMemoryBufferLen(len(arg495))
		defer mbTrans496.Close()
		_, err497 := mbTrans496.WriteString(arg495)
		if err497 != nil {
			Usage()
			return
		}
		factory498 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt499 := factory498.GetProtocol(mbTrans496)
		containerStruct2 := hbase.NewScannerOpenWithPrefixArgs()
		err500 := containerStruct2.ReadField3(jsProt499)
		if err500 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		arg501 := flag.Arg(4)
		mbTrans502 := thrift.NewTMemoryBufferLen(len(arg501))
		defer mbTrans502.Close()
		_, err503 := mbTrans502.WriteString(arg501)
		if err503 != nil {
			Usage()
			return
		}
		factory504 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt505 := factory504.GetProtocol(mbTrans502)
		containerStruct3 := hbase.NewScannerOpenWithPrefixArgs()
		err506 := containerStruct3.ReadField4(jsProt505)
		if err506 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Attributes
		value3 := argvalue3
		fmt.Print(client.ScannerOpenWithPrefix(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "scannerOpenTs":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "ScannerOpenTs requires 5 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		arg509 := flag.Arg(3)
		mbTrans510 := thrift.NewTMemoryBufferLen(len(arg509))
		defer mbTrans510.Close()
		_, err511 := mbTrans510.WriteString(arg509)
		if err511 != nil {
			Usage()
			return
		}
		factory512 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt513 := factory512.GetProtocol(mbTrans510)
		containerStruct2 := hbase.NewScannerOpenTsArgs()
		err514 := containerStruct2.ReadField3(jsProt513)
		if err514 != nil {
			Usage()
			return
		}
		argvalue2 := containerStruct2.Columns
		value2 := argvalue2
		argvalue3, err515 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err515 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		arg516 := flag.Arg(5)
		mbTrans517 := thrift.NewTMemoryBufferLen(len(arg516))
		defer mbTrans517.Close()
		_, err518 := mbTrans517.WriteString(arg516)
		if err518 != nil {
			Usage()
			return
		}
		factory519 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt520 := factory519.GetProtocol(mbTrans517)
		containerStruct4 := hbase.NewScannerOpenTsArgs()
		err521 := containerStruct4.ReadField5(jsProt520)
		if err521 != nil {
			Usage()
			return
		}
		argvalue4 := containerStruct4.Attributes
		value4 := argvalue4
		fmt.Print(client.ScannerOpenTs(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "scannerOpenWithStopTs":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "ScannerOpenWithStopTs requires 6 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		argvalue2 := []byte(flag.Arg(3))
		value2 := hbase.Text(argvalue2)
		arg525 := flag.Arg(4)
		mbTrans526 := thrift.NewTMemoryBufferLen(len(arg525))
		defer mbTrans526.Close()
		_, err527 := mbTrans526.WriteString(arg525)
		if err527 != nil {
			Usage()
			return
		}
		factory528 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt529 := factory528.GetProtocol(mbTrans526)
		containerStruct3 := hbase.NewScannerOpenWithStopTsArgs()
		err530 := containerStruct3.ReadField4(jsProt529)
		if err530 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Columns
		value3 := argvalue3
		argvalue4, err531 := (strconv.ParseInt(flag.Arg(5), 10, 64))
		if err531 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		arg532 := flag.Arg(6)
		mbTrans533 := thrift.NewTMemoryBufferLen(len(arg532))
		defer mbTrans533.Close()
		_, err534 := mbTrans533.WriteString(arg532)
		if err534 != nil {
			Usage()
			return
		}
		factory535 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt536 := factory535.GetProtocol(mbTrans533)
		containerStruct5 := hbase.NewScannerOpenWithStopTsArgs()
		err537 := containerStruct5.ReadField6(jsProt536)
		if err537 != nil {
			Usage()
			return
		}
		argvalue5 := containerStruct5.Attributes
		value5 := argvalue5
		fmt.Print(client.ScannerOpenWithStopTs(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "scannerGet":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ScannerGet requires 1 args")
			flag.Usage()
		}
		tmp0, err538 := (strconv.Atoi(flag.Arg(1)))
		if err538 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := hbase.ScannerID(argvalue0)
		fmt.Print(client.ScannerGet(value0))
		fmt.Print("\n")
		break
	case "scannerGetList":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ScannerGetList requires 2 args")
			flag.Usage()
		}
		tmp0, err539 := (strconv.Atoi(flag.Arg(1)))
		if err539 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := hbase.ScannerID(argvalue0)
		tmp1, err540 := (strconv.Atoi(flag.Arg(2)))
		if err540 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		fmt.Print(client.ScannerGetList(value0, value1))
		fmt.Print("\n")
		break
	case "scannerClose":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ScannerClose requires 1 args")
			flag.Usage()
		}
		tmp0, err541 := (strconv.Atoi(flag.Arg(1)))
		if err541 != nil {
			Usage()
			return
		}
		argvalue0 := int32(tmp0)
		value0 := hbase.ScannerID(argvalue0)
		fmt.Print(client.ScannerClose(value0))
		fmt.Print("\n")
		break
	case "getRegionInfo":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetRegionInfo requires 1 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		fmt.Print(client.GetRegionInfo(value0))
		fmt.Print("\n")
		break
	case "append":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "Append requires 1 args")
			flag.Usage()
		}
		arg543 := flag.Arg(1)
		mbTrans544 := thrift.NewTMemoryBufferLen(len(arg543))
		defer mbTrans544.Close()
		_, err545 := mbTrans544.WriteString(arg543)
		if err545 != nil {
			Usage()
			return
		}
		factory546 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt547 := factory546.GetProtocol(mbTrans544)
		argvalue0 := hbase.NewTAppend()
		err548 := argvalue0.Read(jsProt547)
		if err548 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.Append(value0))
		fmt.Print("\n")
		break
	case "checkAndPut":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "CheckAndPut requires 6 args")
			flag.Usage()
		}
		argvalue0 := []byte(flag.Arg(1))
		value0 := hbase.Text(argvalue0)
		argvalue1 := []byte(flag.Arg(2))
		value1 := hbase.Text(argvalue1)
		argvalue2 := []byte(flag.Arg(3))
		value2 := hbase.Text(argvalue2)
		argvalue3 := []byte(flag.Arg(4))
		value3 := hbase.Text(argvalue3)
		arg553 := flag.Arg(5)
		mbTrans554 := thrift.NewTMemoryBufferLen(len(arg553))
		defer mbTrans554.Close()
		_, err555 := mbTrans554.WriteString(arg553)
		if err555 != nil {
			Usage()
			return
		}
		factory556 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt557 := factory556.GetProtocol(mbTrans554)
		argvalue4 := hbase.NewMutation()
		err558 := argvalue4.Read(jsProt557)
		if err558 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		arg559 := flag.Arg(6)
		mbTrans560 := thrift.NewTMemoryBufferLen(len(arg559))
		defer mbTrans560.Close()
		_, err561 := mbTrans560.WriteString(arg559)
		if err561 != nil {
			Usage()
			return
		}
		factory562 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt563 := factory562.GetProtocol(mbTrans560)
		containerStruct5 := hbase.NewCheckAndPutArgs()
		err564 := containerStruct5.ReadField6(jsProt563)
		if err564 != nil {
			Usage()
			return
		}
		argvalue5 := containerStruct5.Attributes
		value5 := argvalue5
		fmt.Print(client.CheckAndPut(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}