コード例 #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 := services.NewResourceManagerClientFactory(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 != 3 {
			fmt.Fprintln(os.Stderr, "CreateResource requires 3 args")
			flag.Usage()
		}
		arg664 := flag.Arg(1)
		mbTrans665 := thrift.NewTMemoryBufferLen(len(arg664))
		defer mbTrans665.Close()
		_, err666 := mbTrans665.WriteString(arg664)
		if err666 != nil {
			Usage()
			return
		}
		factory667 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt668 := factory667.GetProtocol(mbTrans665)
		argvalue0 := services.NewResource()
		err669 := argvalue0.Read(jsProt668)
		if err669 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg670 := flag.Arg(2)
		mbTrans671 := thrift.NewTMemoryBufferLen(len(arg670))
		defer mbTrans671.Close()
		_, err672 := mbTrans671.WriteString(arg670)
		if err672 != nil {
			Usage()
			return
		}
		factory673 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt674 := factory673.GetProtocol(mbTrans671)
		containerStruct1 := services.NewCreateResourceArgs()
		err675 := containerStruct1.ReadField2(jsProt674)
		if err675 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Tags
		value1 := argvalue1
		arg676 := flag.Arg(3)
		mbTrans677 := thrift.NewTMemoryBufferLen(len(arg676))
		defer mbTrans677.Close()
		_, err678 := mbTrans677.WriteString(arg676)
		if err678 != nil {
			Usage()
			return
		}
		factory679 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt680 := factory679.GetProtocol(mbTrans677)
		argvalue2 := services.NewFromInfo()
		err681 := argvalue2.Read(jsProt680)
		if err681 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.CreateResource(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getResource":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "GetResource requires 3 args")
			flag.Usage()
		}
		argvalue0, err682 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err682 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err683 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err683 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg684 := flag.Arg(3)
		mbTrans685 := thrift.NewTMemoryBufferLen(len(arg684))
		defer mbTrans685.Close()
		_, err686 := mbTrans685.WriteString(arg684)
		if err686 != nil {
			Usage()
			return
		}
		factory687 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt688 := factory687.GetProtocol(mbTrans685)
		argvalue2 := services.NewFromInfo()
		err689 := argvalue2.Read(jsProt688)
		if err689 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.GetResource(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getResourceInfo":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "GetResourceInfo requires 3 args")
			flag.Usage()
		}
		argvalue0, err690 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err690 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err691 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err691 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg692 := flag.Arg(3)
		mbTrans693 := thrift.NewTMemoryBufferLen(len(arg692))
		defer mbTrans693.Close()
		_, err694 := mbTrans693.WriteString(arg692)
		if err694 != nil {
			Usage()
			return
		}
		factory695 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt696 := factory695.GetProtocol(mbTrans693)
		argvalue2 := services.NewFromInfo()
		err697 := argvalue2.Read(jsProt696)
		if err697 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.GetResourceInfo(value0, value1, value2))
		fmt.Print("\n")
		break
	case "updateResource":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "UpdateResource requires 5 args")
			flag.Usage()
		}
		arg698 := flag.Arg(1)
		mbTrans699 := thrift.NewTMemoryBufferLen(len(arg698))
		defer mbTrans699.Close()
		_, err700 := mbTrans699.WriteString(arg698)
		if err700 != nil {
			Usage()
			return
		}
		factory701 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt702 := factory701.GetProtocol(mbTrans699)
		argvalue0 := services.NewResource()
		err703 := argvalue0.Read(jsProt702)
		if err703 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err704 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err704 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2, err705 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err705 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg706 := flag.Arg(4)
		mbTrans707 := thrift.NewTMemoryBufferLen(len(arg706))
		defer mbTrans707.Close()
		_, err708 := mbTrans707.WriteString(arg706)
		if err708 != nil {
			Usage()
			return
		}
		factory709 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt710 := factory709.GetProtocol(mbTrans707)
		containerStruct3 := services.NewUpdateResourceArgs()
		err711 := containerStruct3.ReadField4(jsProt710)
		if err711 != nil {
			Usage()
			return
		}
		argvalue3 := containerStruct3.Tags
		value3 := argvalue3
		arg712 := flag.Arg(5)
		mbTrans713 := thrift.NewTMemoryBufferLen(len(arg712))
		defer mbTrans713.Close()
		_, err714 := mbTrans713.WriteString(arg712)
		if err714 != nil {
			Usage()
			return
		}
		factory715 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt716 := factory715.GetProtocol(mbTrans713)
		argvalue4 := services.NewFromInfo()
		err717 := argvalue4.Read(jsProt716)
		if err717 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		fmt.Print(client.UpdateResource(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "deleteResourceBySharedId":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "DeleteResourceBySharedId requires 3 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		argvalue1, err719 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err719 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg720 := flag.Arg(3)
		mbTrans721 := thrift.NewTMemoryBufferLen(len(arg720))
		defer mbTrans721.Close()
		_, err722 := mbTrans721.WriteString(arg720)
		if err722 != nil {
			Usage()
			return
		}
		factory723 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt724 := factory723.GetProtocol(mbTrans721)
		argvalue2 := services.NewFromInfo()
		err725 := argvalue2.Read(jsProt724)
		if err725 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.DeleteResourceBySharedId(value0, value1, value2))
		fmt.Print("\n")
		break
	case "deleteResource":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "DeleteResource requires 3 args")
			flag.Usage()
		}
		argvalue0, err726 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err726 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err727 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err727 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg728 := flag.Arg(3)
		mbTrans729 := thrift.NewTMemoryBufferLen(len(arg728))
		defer mbTrans729.Close()
		_, err730 := mbTrans729.WriteString(arg728)
		if err730 != nil {
			Usage()
			return
		}
		factory731 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt732 := factory731.GetProtocol(mbTrans729)
		argvalue2 := services.NewFromInfo()
		err733 := argvalue2.Read(jsProt732)
		if err733 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.DeleteResource(value0, value1, value2))
		fmt.Print("\n")
		break
	case "shareResource":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "ShareResource requires 5 args")
			flag.Usage()
		}
		arg734 := flag.Arg(1)
		mbTrans735 := thrift.NewTMemoryBufferLen(len(arg734))
		defer mbTrans735.Close()
		_, err736 := mbTrans735.WriteString(arg734)
		if err736 != nil {
			Usage()
			return
		}
		factory737 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt738 := factory737.GetProtocol(mbTrans735)
		argvalue0 := services.NewResource()
		err739 := argvalue0.Read(jsProt738)
		if err739 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg740 := flag.Arg(2)
		mbTrans741 := thrift.NewTMemoryBufferLen(len(arg740))
		defer mbTrans741.Close()
		_, err742 := mbTrans741.WriteString(arg740)
		if err742 != nil {
			Usage()
			return
		}
		factory743 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt744 := factory743.GetProtocol(mbTrans741)
		containerStruct1 := services.NewShareResourceArgs()
		err745 := containerStruct1.ReadField2(jsProt744)
		if err745 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.ShareGroups
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := services.Zone(tmp2)
		value2 := argvalue2
		argvalue3, err746 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err746 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		arg747 := flag.Arg(5)
		mbTrans748 := thrift.NewTMemoryBufferLen(len(arg747))
		defer mbTrans748.Close()
		_, err749 := mbTrans748.WriteString(arg747)
		if err749 != nil {
			Usage()
			return
		}
		factory750 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt751 := factory750.GetProtocol(mbTrans748)
		argvalue4 := services.NewFromInfo()
		err752 := argvalue4.Read(jsProt751)
		if err752 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		fmt.Print(client.ShareResource(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "getSharedResources":
		if flag.NArg()-1 != 9 {
			fmt.Fprintln(os.Stderr, "GetSharedResources requires 9 args")
			flag.Usage()
		}
		argvalue0, err753 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err753 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := services.Zone(tmp1)
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := services.ResourceType(tmp2)
		value2 := argvalue2
		argvalue3, err754 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err754 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		argvalue4, err755 := (strconv.ParseInt(flag.Arg(5), 10, 64))
		if err755 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		argvalue5, err756 := (strconv.ParseInt(flag.Arg(6), 10, 64))
		if err756 != nil {
			Usage()
			return
		}
		value5 := argvalue5
		argvalue6 := flag.Arg(7) == "true"
		value6 := argvalue6
		tmp7, err758 := (strconv.Atoi(flag.Arg(8)))
		if err758 != nil {
			Usage()
			return
		}
		argvalue7 := int32(tmp7)
		value7 := argvalue7
		arg759 := flag.Arg(9)
		mbTrans760 := thrift.NewTMemoryBufferLen(len(arg759))
		defer mbTrans760.Close()
		_, err761 := mbTrans760.WriteString(arg759)
		if err761 != nil {
			Usage()
			return
		}
		factory762 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt763 := factory762.GetProtocol(mbTrans760)
		argvalue8 := services.NewFromInfo()
		err764 := argvalue8.Read(jsProt763)
		if err764 != nil {
			Usage()
			return
		}
		value8 := argvalue8
		fmt.Print(client.GetSharedResources(value0, value1, value2, value3, value4, value5, value6, value7, value8))
		fmt.Print("\n")
		break
	case "cancelSharedResource":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "CancelSharedResource requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg766 := flag.Arg(2)
		mbTrans767 := thrift.NewTMemoryBufferLen(len(arg766))
		defer mbTrans767.Close()
		_, err768 := mbTrans767.WriteString(arg766)
		if err768 != nil {
			Usage()
			return
		}
		factory769 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt770 := factory769.GetProtocol(mbTrans767)
		argvalue1 := services.NewFromInfo()
		err771 := argvalue1.Read(jsProt770)
		if err771 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.CancelSharedResource(value0, value1))
		fmt.Print("\n")
		break
	case "getUserResources":
		if flag.NArg()-1 != 8 {
			fmt.Fprintln(os.Stderr, "GetUserResources requires 8 args")
			flag.Usage()
		}
		argvalue0, err772 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err772 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := services.ResourceType(tmp1)
		value1 := argvalue1
		argvalue2, err773 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err773 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		argvalue3, err774 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err774 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		argvalue4, err775 := (strconv.ParseInt(flag.Arg(5), 10, 64))
		if err775 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		argvalue5 := flag.Arg(6) == "true"
		value5 := argvalue5
		tmp6, err777 := (strconv.Atoi(flag.Arg(7)))
		if err777 != nil {
			Usage()
			return
		}
		argvalue6 := int32(tmp6)
		value6 := argvalue6
		arg778 := flag.Arg(8)
		mbTrans779 := thrift.NewTMemoryBufferLen(len(arg778))
		defer mbTrans779.Close()
		_, err780 := mbTrans779.WriteString(arg778)
		if err780 != nil {
			Usage()
			return
		}
		factory781 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt782 := factory781.GetProtocol(mbTrans779)
		argvalue7 := services.NewFromInfo()
		err783 := argvalue7.Read(jsProt782)
		if err783 != nil {
			Usage()
			return
		}
		value7 := argvalue7
		fmt.Print(client.GetUserResources(value0, value1, value2, value3, value4, value5, value6, value7))
		fmt.Print("\n")
		break
	case "addComment":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "AddComment requires 2 args")
			flag.Usage()
		}
		arg784 := flag.Arg(1)
		mbTrans785 := thrift.NewTMemoryBufferLen(len(arg784))
		defer mbTrans785.Close()
		_, err786 := mbTrans785.WriteString(arg784)
		if err786 != nil {
			Usage()
			return
		}
		factory787 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt788 := factory787.GetProtocol(mbTrans785)
		argvalue0 := services.NewComment()
		err789 := argvalue0.Read(jsProt788)
		if err789 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg790 := flag.Arg(2)
		mbTrans791 := thrift.NewTMemoryBufferLen(len(arg790))
		defer mbTrans791.Close()
		_, err792 := mbTrans791.WriteString(arg790)
		if err792 != nil {
			Usage()
			return
		}
		factory793 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt794 := factory793.GetProtocol(mbTrans791)
		argvalue1 := services.NewFromInfo()
		err795 := argvalue1.Read(jsProt794)
		if err795 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.AddComment(value0, value1))
		fmt.Print("\n")
		break
	case "deleteComment":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "DeleteComment requires 6 args")
			flag.Usage()
		}
		argvalue0, err796 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err796 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err797 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err797 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2, err798 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err798 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		argvalue3, err799 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err799 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		argvalue4, err800 := (strconv.ParseInt(flag.Arg(5), 10, 64))
		if err800 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		arg801 := flag.Arg(6)
		mbTrans802 := thrift.NewTMemoryBufferLen(len(arg801))
		defer mbTrans802.Close()
		_, err803 := mbTrans802.WriteString(arg801)
		if err803 != nil {
			Usage()
			return
		}
		factory804 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt805 := factory804.GetProtocol(mbTrans802)
		argvalue5 := services.NewFromInfo()
		err806 := argvalue5.Read(jsProt805)
		if err806 != nil {
			Usage()
			return
		}
		value5 := argvalue5
		fmt.Print(client.DeleteComment(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "getComments":
		if flag.NArg()-1 != 7 {
			fmt.Fprintln(os.Stderr, "GetComments requires 7 args")
			flag.Usage()
		}
		argvalue0, err807 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err807 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err808 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err808 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2, err809 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err809 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		argvalue3, err810 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err810 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		argvalue4 := flag.Arg(5) == "true"
		value4 := argvalue4
		tmp5, err812 := (strconv.Atoi(flag.Arg(6)))
		if err812 != nil {
			Usage()
			return
		}
		argvalue5 := int32(tmp5)
		value5 := argvalue5
		arg813 := flag.Arg(7)
		mbTrans814 := thrift.NewTMemoryBufferLen(len(arg813))
		defer mbTrans814.Close()
		_, err815 := mbTrans814.WriteString(arg813)
		if err815 != nil {
			Usage()
			return
		}
		factory816 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt817 := factory816.GetProtocol(mbTrans814)
		argvalue6 := services.NewFromInfo()
		err818 := argvalue6.Read(jsProt817)
		if err818 != nil {
			Usage()
			return
		}
		value6 := argvalue6
		fmt.Print(client.GetComments(value0, value1, value2, value3, value4, value5, value6))
		fmt.Print("\n")
		break
	case "operateThumb":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "OperateThumb requires 6 args")
			flag.Usage()
		}
		argvalue0, err819 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err819 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err820 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err820 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := services.ThumbType(tmp2)
		value2 := argvalue2
		argvalue3, err821 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err821 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		tmp4, err := (strconv.Atoi(flag.Arg(5)))
		if err != nil {
			Usage()
			return
		}
		argvalue4 := services.ResourceType(tmp4)
		value4 := argvalue4
		arg822 := flag.Arg(6)
		mbTrans823 := thrift.NewTMemoryBufferLen(len(arg822))
		defer mbTrans823.Close()
		_, err824 := mbTrans823.WriteString(arg822)
		if err824 != nil {
			Usage()
			return
		}
		factory825 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt826 := factory825.GetProtocol(mbTrans823)
		argvalue5 := services.NewFromInfo()
		err827 := argvalue5.Read(jsProt826)
		if err827 != nil {
			Usage()
			return
		}
		value5 := argvalue5
		fmt.Print(client.OperateThumb(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "getThumbs":
		if flag.NArg()-1 != 8 {
			fmt.Fprintln(os.Stderr, "GetThumbs requires 8 args")
			flag.Usage()
		}
		argvalue0, err828 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err828 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err829 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err829 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := services.ThumbType(tmp2)
		value2 := argvalue2
		argvalue3, err830 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err830 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		argvalue4, err831 := (strconv.ParseInt(flag.Arg(5), 10, 64))
		if err831 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		argvalue5 := flag.Arg(6) == "true"
		value5 := argvalue5
		tmp6, err833 := (strconv.Atoi(flag.Arg(7)))
		if err833 != nil {
			Usage()
			return
		}
		argvalue6 := int32(tmp6)
		value6 := argvalue6
		arg834 := flag.Arg(8)
		mbTrans835 := thrift.NewTMemoryBufferLen(len(arg834))
		defer mbTrans835.Close()
		_, err836 := mbTrans835.WriteString(arg834)
		if err836 != nil {
			Usage()
			return
		}
		factory837 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt838 := factory837.GetProtocol(mbTrans835)
		argvalue7 := services.NewFromInfo()
		err839 := argvalue7.Read(jsProt838)
		if err839 != nil {
			Usage()
			return
		}
		value7 := argvalue7
		fmt.Print(client.GetThumbs(value0, value1, value2, value3, value4, value5, value6, value7))
		fmt.Print("\n")
		break
	case "registerResourceNotification":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "RegisterResourceNotification requires 3 args")
			flag.Usage()
		}
		argvalue0, err840 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err840 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err841 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err841 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg842 := flag.Arg(3)
		mbTrans843 := thrift.NewTMemoryBufferLen(len(arg842))
		defer mbTrans843.Close()
		_, err844 := mbTrans843.WriteString(arg842)
		if err844 != nil {
			Usage()
			return
		}
		factory845 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt846 := factory845.GetProtocol(mbTrans843)
		argvalue2 := services.NewFromInfo()
		err847 := argvalue2.Read(jsProt846)
		if err847 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.RegisterResourceNotification(value0, value1, value2))
		fmt.Print("\n")
		break
	case "unregisterResourceNotification":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "UnregisterResourceNotification requires 4 args")
			flag.Usage()
		}
		argvalue0, err848 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err848 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err849 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err849 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := services.ResourceType(tmp2)
		value2 := argvalue2
		arg850 := flag.Arg(4)
		mbTrans851 := thrift.NewTMemoryBufferLen(len(arg850))
		defer mbTrans851.Close()
		_, err852 := mbTrans851.WriteString(arg850)
		if err852 != nil {
			Usage()
			return
		}
		factory853 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt854 := factory853.GetProtocol(mbTrans851)
		argvalue3 := services.NewFromInfo()
		err855 := argvalue3.Read(jsProt854)
		if err855 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.UnregisterResourceNotification(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "sendResourceNotification":
		if flag.NArg()-1 != 5 {
			fmt.Fprintln(os.Stderr, "SendResourceNotification requires 5 args")
			flag.Usage()
		}
		argvalue0, err856 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err856 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err857 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err857 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg858 := flag.Arg(3)
		mbTrans859 := thrift.NewTMemoryBufferLen(len(arg858))
		defer mbTrans859.Close()
		_, err860 := mbTrans859.WriteString(arg858)
		if err860 != nil {
			Usage()
			return
		}
		factory861 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt862 := factory861.GetProtocol(mbTrans859)
		argvalue2 := services.NewComment()
		err863 := argvalue2.Read(jsProt862)
		if err863 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		argvalue3, err864 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err864 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		arg865 := flag.Arg(5)
		mbTrans866 := thrift.NewTMemoryBufferLen(len(arg865))
		defer mbTrans866.Close()
		_, err867 := mbTrans866.WriteString(arg865)
		if err867 != nil {
			Usage()
			return
		}
		factory868 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt869 := factory868.GetProtocol(mbTrans866)
		argvalue4 := services.NewFromInfo()
		err870 := argvalue4.Read(jsProt869)
		if err870 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		fmt.Print(client.SendResourceNotification(value0, value1, value2, value3, value4))
		fmt.Print("\n")
		break
	case "getCommentsHistory":
		if flag.NArg()-1 != 8 {
			fmt.Fprintln(os.Stderr, "GetCommentsHistory requires 8 args")
			flag.Usage()
		}
		argvalue0, err871 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err871 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := services.CommentHistoryType(tmp1)
		value1 := argvalue1
		argvalue2, err872 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err872 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		argvalue3, err873 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err873 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		argvalue4, err874 := (strconv.ParseInt(flag.Arg(5), 10, 64))
		if err874 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		argvalue5 := flag.Arg(6) == "true"
		value5 := argvalue5
		tmp6, err876 := (strconv.Atoi(flag.Arg(7)))
		if err876 != nil {
			Usage()
			return
		}
		argvalue6 := int32(tmp6)
		value6 := argvalue6
		arg877 := flag.Arg(8)
		mbTrans878 := thrift.NewTMemoryBufferLen(len(arg877))
		defer mbTrans878.Close()
		_, err879 := mbTrans878.WriteString(arg877)
		if err879 != nil {
			Usage()
			return
		}
		factory880 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt881 := factory880.GetProtocol(mbTrans878)
		argvalue7 := services.NewFromInfo()
		err882 := argvalue7.Read(jsProt881)
		if err882 != nil {
			Usage()
			return
		}
		value7 := argvalue7
		fmt.Print(client.GetCommentsHistory(value0, value1, value2, value3, value4, value5, value6, value7))
		fmt.Print("\n")
		break
	case "deleteCommentHistory":
		if flag.NArg()-1 != 6 {
			fmt.Fprintln(os.Stderr, "DeleteCommentHistory requires 6 args")
			flag.Usage()
		}
		argvalue0, err883 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err883 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := services.CommentHistoryType(tmp1)
		value1 := argvalue1
		argvalue2, err884 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err884 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		argvalue3, err885 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err885 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		argvalue4, err886 := (strconv.ParseInt(flag.Arg(5), 10, 64))
		if err886 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		arg887 := flag.Arg(6)
		mbTrans888 := thrift.NewTMemoryBufferLen(len(arg887))
		defer mbTrans888.Close()
		_, err889 := mbTrans888.WriteString(arg887)
		if err889 != nil {
			Usage()
			return
		}
		factory890 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt891 := factory890.GetProtocol(mbTrans888)
		argvalue5 := services.NewFromInfo()
		err892 := argvalue5.Read(jsProt891)
		if err892 != nil {
			Usage()
			return
		}
		value5 := argvalue5
		fmt.Print(client.DeleteCommentHistory(value0, value1, value2, value3, value4, value5))
		fmt.Print("\n")
		break
	case "updateGroupResourceName":
		if flag.NArg()-1 != 7 {
			fmt.Fprintln(os.Stderr, "UpdateGroupResourceName requires 7 args")
			flag.Usage()
		}
		argvalue0, err893 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err893 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := services.Zone(tmp1)
		value1 := argvalue1
		tmp2, err := (strconv.Atoi(flag.Arg(3)))
		if err != nil {
			Usage()
			return
		}
		argvalue2 := services.ResourceType(tmp2)
		value2 := argvalue2
		argvalue3, err894 := (strconv.ParseInt(flag.Arg(4), 10, 64))
		if err894 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		argvalue4, err895 := (strconv.ParseInt(flag.Arg(5), 10, 64))
		if err895 != nil {
			Usage()
			return
		}
		value4 := argvalue4
		argvalue5 := flag.Arg(6)
		value5 := argvalue5
		arg897 := flag.Arg(7)
		mbTrans898 := thrift.NewTMemoryBufferLen(len(arg897))
		defer mbTrans898.Close()
		_, err899 := mbTrans898.WriteString(arg897)
		if err899 != nil {
			Usage()
			return
		}
		factory900 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt901 := factory900.GetProtocol(mbTrans898)
		argvalue6 := services.NewFromInfo()
		err902 := argvalue6.Read(jsProt901)
		if err902 != nil {
			Usage()
			return
		}
		value6 := argvalue6
		fmt.Print(client.UpdateGroupResourceName(value0, value1, value2, value3, value4, value5, value6))
		fmt.Print("\n")
		break
	case "getSharedGroupResource":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetSharedGroupResource requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg904 := flag.Arg(2)
		mbTrans905 := thrift.NewTMemoryBufferLen(len(arg904))
		defer mbTrans905.Close()
		_, err906 := mbTrans905.WriteString(arg904)
		if err906 != nil {
			Usage()
			return
		}
		factory907 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt908 := factory907.GetProtocol(mbTrans905)
		argvalue1 := services.NewFromInfo()
		err909 := argvalue1.Read(jsProt908)
		if err909 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.GetSharedGroupResource(value0, value1))
		fmt.Print("\n")
		break
	case "getResourceChatRoomViewer":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "GetResourceChatRoomViewer requires 4 args")
			flag.Usage()
		}
		argvalue0, err910 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err910 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err911 := (strconv.Atoi(flag.Arg(2)))
		if err911 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		argvalue2, err912 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err912 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg913 := flag.Arg(4)
		mbTrans914 := thrift.NewTMemoryBufferLen(len(arg913))
		defer mbTrans914.Close()
		_, err915 := mbTrans914.WriteString(arg913)
		if err915 != nil {
			Usage()
			return
		}
		factory916 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt917 := factory916.GetProtocol(mbTrans914)
		argvalue3 := services.NewFromInfo()
		err918 := argvalue3.Read(jsProt917)
		if err918 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.GetResourceChatRoomViewer(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "getResourceChatRoomViewerCount":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "GetResourceChatRoomViewerCount requires 2 args")
			flag.Usage()
		}
		argvalue0, err919 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err919 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg920 := flag.Arg(2)
		mbTrans921 := thrift.NewTMemoryBufferLen(len(arg920))
		defer mbTrans921.Close()
		_, err922 := mbTrans921.WriteString(arg920)
		if err922 != nil {
			Usage()
			return
		}
		factory923 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt924 := factory923.GetProtocol(mbTrans921)
		argvalue1 := services.NewFromInfo()
		err925 := argvalue1.Read(jsProt924)
		if err925 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.GetResourceChatRoomViewerCount(value0, value1))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
コード例 #2
0
ファイル: live_manager-remote.go プロジェクト: lei-yu/GOPATH
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.NewLiveManagerClientFactory(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 "joinLive":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "JoinLive requires 3 args")
			flag.Usage()
		}
		argvalue0, err1189 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err1189 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err1190 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err1190 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg1191 := flag.Arg(3)
		mbTrans1192 := thrift.NewTMemoryBufferLen(len(arg1191))
		defer mbTrans1192.Close()
		_, err1193 := mbTrans1192.WriteString(arg1191)
		if err1193 != nil {
			Usage()
			return
		}
		factory1194 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1195 := factory1194.GetProtocol(mbTrans1192)
		argvalue2 := services.NewFromInfo()
		err1196 := argvalue2.Read(jsProt1195)
		if err1196 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.JoinLive(value0, value1, value2))
		fmt.Print("\n")
		break
	case "getLiveInfo":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "GetLiveInfo requires 3 args")
			flag.Usage()
		}
		argvalue0, err1197 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err1197 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err1198 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err1198 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg1199 := flag.Arg(3)
		mbTrans1200 := thrift.NewTMemoryBufferLen(len(arg1199))
		defer mbTrans1200.Close()
		_, err1201 := mbTrans1200.WriteString(arg1199)
		if err1201 != nil {
			Usage()
			return
		}
		factory1202 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1203 := factory1202.GetProtocol(mbTrans1200)
		argvalue2 := services.NewFromInfo()
		err1204 := argvalue2.Read(jsProt1203)
		if err1204 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.GetLiveInfo(value0, value1, value2))
		fmt.Print("\n")
		break
	case "leaveLive":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "LeaveLive requires 3 args")
			flag.Usage()
		}
		argvalue0, err1205 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err1205 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err1206 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err1206 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg1207 := flag.Arg(3)
		mbTrans1208 := thrift.NewTMemoryBufferLen(len(arg1207))
		defer mbTrans1208.Close()
		_, err1209 := mbTrans1208.WriteString(arg1207)
		if err1209 != nil {
			Usage()
			return
		}
		factory1210 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1211 := factory1210.GetProtocol(mbTrans1208)
		argvalue2 := services.NewFromInfo()
		err1212 := argvalue2.Read(jsProt1211)
		if err1212 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.LeaveLive(value0, value1, value2))
		fmt.Print("\n")
		break
	case "sendLiveMessage":
		if flag.NArg()-1 != 4 {
			fmt.Fprintln(os.Stderr, "SendLiveMessage requires 4 args")
			flag.Usage()
		}
		argvalue0, err1213 := (strconv.ParseInt(flag.Arg(1), 10, 64))
		if err1213 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1, err1214 := (strconv.ParseInt(flag.Arg(2), 10, 64))
		if err1214 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		arg1215 := flag.Arg(3)
		mbTrans1216 := thrift.NewTMemoryBufferLen(len(arg1215))
		defer mbTrans1216.Close()
		_, err1217 := mbTrans1216.WriteString(arg1215)
		if err1217 != nil {
			Usage()
			return
		}
		factory1218 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1219 := factory1218.GetProtocol(mbTrans1216)
		argvalue2 := services.NewComment()
		err1220 := argvalue2.Read(jsProt1219)
		if err1220 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		arg1221 := flag.Arg(4)
		mbTrans1222 := thrift.NewTMemoryBufferLen(len(arg1221))
		defer mbTrans1222.Close()
		_, err1223 := mbTrans1222.WriteString(arg1221)
		if err1223 != nil {
			Usage()
			return
		}
		factory1224 := thrift.NewTSimpleJSONProtocolFactory()
		jsProt1225 := factory1224.GetProtocol(mbTrans1222)
		argvalue3 := services.NewFromInfo()
		err1226 := argvalue3.Read(jsProt1225)
		if err1226 != nil {
			Usage()
			return
		}
		value3 := argvalue3
		fmt.Print(client.SendLiveMessage(value0, value1, value2, value3))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}