// Autogenerated by Thrift Compiler (0.12.0)
// DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING

package main

import (
	"apache/aurora"
	"context"
	"flag"
	"fmt"
	"math"
	"net"
	"net/url"
	"os"
	"strconv"
	"strings"

	"git.apache.org/thrift.git/lib/go/thrift"
)

func Usage() {
	fmt.Fprintln(os.Stderr, "Usage of ", os.Args[0], " [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]:")
	flag.PrintDefaults()
	fmt.Fprintln(os.Stderr, "\nFunctions:")
	fmt.Fprintln(os.Stderr, "  Response setQuota(string ownerRole, ResourceAggregate quota)")
	fmt.Fprintln(os.Stderr, "  Response forceTaskState(string taskId, ScheduleStatus status)")
	fmt.Fprintln(os.Stderr, "  Response performBackup()")
	fmt.Fprintln(os.Stderr, "  Response listBackups()")
	fmt.Fprintln(os.Stderr, "  Response stageRecovery(string backupId)")
	fmt.Fprintln(os.Stderr, "  Response queryRecovery(TaskQuery query)")
	fmt.Fprintln(os.Stderr, "  Response deleteRecoveryTasks(TaskQuery query)")
	fmt.Fprintln(os.Stderr, "  Response commitRecovery()")
	fmt.Fprintln(os.Stderr, "  Response unloadRecovery()")
	fmt.Fprintln(os.Stderr, "  Response startMaintenance(Hosts hosts)")
	fmt.Fprintln(os.Stderr, "  Response drainHosts(Hosts hosts)")
	fmt.Fprintln(os.Stderr, "  Response maintenanceStatus(Hosts hosts)")
	fmt.Fprintln(os.Stderr, "  Response endMaintenance(Hosts hosts)")
	fmt.Fprintln(os.Stderr, "  Response slaDrainHosts(Hosts hosts, SlaPolicy defaultSlaPolicy, i64 timeoutSecs)")
	fmt.Fprintln(os.Stderr, "  Response snapshot()")
	fmt.Fprintln(os.Stderr, "  Response triggerExplicitTaskReconciliation(ExplicitReconciliationSettings settings)")
	fmt.Fprintln(os.Stderr, "  Response triggerImplicitTaskReconciliation()")
	fmt.Fprintln(os.Stderr, "  Response pruneTasks(TaskQuery query)")
	fmt.Fprintln(os.Stderr, "  Response createJob(JobConfiguration description)")
	fmt.Fprintln(os.Stderr, "  Response scheduleCronJob(JobConfiguration description)")
	fmt.Fprintln(os.Stderr, "  Response descheduleCronJob(JobKey job)")
	fmt.Fprintln(os.Stderr, "  Response startCronJob(JobKey job)")
	fmt.Fprintln(os.Stderr, "  Response restartShards(JobKey job,  shardIds)")
	fmt.Fprintln(os.Stderr, "  Response killTasks(JobKey job,  instances, string message)")
	fmt.Fprintln(os.Stderr, "  Response addInstances(InstanceKey key, i32 count)")
	fmt.Fprintln(os.Stderr, "  Response replaceCronTemplate(JobConfiguration config)")
	fmt.Fprintln(os.Stderr, "  Response startJobUpdate(JobUpdateRequest request, string message)")
	fmt.Fprintln(os.Stderr, "  Response pauseJobUpdate(JobUpdateKey key, string message)")
	fmt.Fprintln(os.Stderr, "  Response resumeJobUpdate(JobUpdateKey key, string message)")
	fmt.Fprintln(os.Stderr, "  Response abortJobUpdate(JobUpdateKey key, string message)")
	fmt.Fprintln(os.Stderr, "  Response rollbackJobUpdate(JobUpdateKey key, string message)")
	fmt.Fprintln(os.Stderr, "  Response pulseJobUpdate(JobUpdateKey key)")
	fmt.Fprintln(os.Stderr, "  Response getRoleSummary()")
	fmt.Fprintln(os.Stderr, "  Response getJobSummary(string role)")
	fmt.Fprintln(os.Stderr, "  Response getTasksStatus(TaskQuery query)")
	fmt.Fprintln(os.Stderr, "  Response getTasksWithoutConfigs(TaskQuery query)")
	fmt.Fprintln(os.Stderr, "  Response getPendingReason(TaskQuery query)")
	fmt.Fprintln(os.Stderr, "  Response getConfigSummary(JobKey job)")
	fmt.Fprintln(os.Stderr, "  Response getJobs(string ownerRole)")
	fmt.Fprintln(os.Stderr, "  Response getQuota(string ownerRole)")
	fmt.Fprintln(os.Stderr, "  Response populateJobConfig(JobConfiguration description)")
	fmt.Fprintln(os.Stderr, "  Response getJobUpdateSummaries(JobUpdateQuery jobUpdateQuery)")
	fmt.Fprintln(os.Stderr, "  Response getJobUpdateDetails(JobUpdateQuery query)")
	fmt.Fprintln(os.Stderr, "  Response getJobUpdateDiff(JobUpdateRequest request)")
	fmt.Fprintln(os.Stderr, "  Response getTierConfigs()")
	fmt.Fprintln(os.Stderr)
	os.Exit(0)
}

type httpHeaders map[string]string

func (h httpHeaders) String() string {
	var m map[string]string = h
	return fmt.Sprintf("%s", m)
}

func (h httpHeaders) Set(value string) error {
	parts := strings.Split(value, ": ")
	if len(parts) != 2 {
		return fmt.Errorf("header should be of format 'Key: Value'")
	}
	h[parts[0]] = parts[1]
	return nil
}

func main() {
	flag.Usage = Usage
	var host string
	var port int
	var protocol string
	var urlString string
	var framed bool
	var useHttp bool
	headers := make(httpHeaders)
	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.Var(headers, "H", "Headers to set on the http(s) request (e.g. -H \"Key: Value\")")
	flag.Parse()

	if len(urlString) > 0 {
		var err error
		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" || parsedUrl.Scheme == "https"
	} 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())
		if len(headers) > 0 {
			httptrans := trans.(*thrift.THttpClient)
			for key, value := range headers {
				httptrans.SetHeader(key, value)
			}
		}
	} 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)
	}
	iprot := protocolFactory.GetProtocol(trans)
	oprot := protocolFactory.GetProtocol(trans)
	client := aurora.NewAuroraAdminClient(thrift.NewTStandardClient(iprot, oprot))
	if err := trans.Open(); err != nil {
		fmt.Fprintln(os.Stderr, "Error opening socket to ", host, ":", port, " ", err)
		os.Exit(1)
	}

	switch cmd {
	case "setQuota":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "SetQuota requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		arg354 := flag.Arg(2)
		mbTrans355 := thrift.NewTMemoryBufferLen(len(arg354))
		defer mbTrans355.Close()
		_, err356 := mbTrans355.WriteString(arg354)
		if err356 != nil {
			Usage()
			return
		}
		factory357 := thrift.NewTJSONProtocolFactory()
		jsProt358 := factory357.GetProtocol(mbTrans355)
		argvalue1 := aurora.NewResourceAggregate()
		err359 := argvalue1.Read(jsProt358)
		if err359 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		fmt.Print(client.SetQuota(context.Background(), value0, value1))
		fmt.Print("\n")
		break
	case "forceTaskState":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ForceTaskState requires 2 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		tmp1, err := (strconv.Atoi(flag.Arg(2)))
		if err != nil {
			Usage()
			return
		}
		argvalue1 := aurora.ScheduleStatus(tmp1)
		value1 := argvalue1
		fmt.Print(client.ForceTaskState(context.Background(), value0, value1))
		fmt.Print("\n")
		break
	case "performBackup":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "PerformBackup requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.PerformBackup(context.Background()))
		fmt.Print("\n")
		break
	case "listBackups":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "ListBackups requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.ListBackups(context.Background()))
		fmt.Print("\n")
		break
	case "stageRecovery":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "StageRecovery requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.StageRecovery(context.Background(), value0))
		fmt.Print("\n")
		break
	case "queryRecovery":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "QueryRecovery requires 1 args")
			flag.Usage()
		}
		arg362 := flag.Arg(1)
		mbTrans363 := thrift.NewTMemoryBufferLen(len(arg362))
		defer mbTrans363.Close()
		_, err364 := mbTrans363.WriteString(arg362)
		if err364 != nil {
			Usage()
			return
		}
		factory365 := thrift.NewTJSONProtocolFactory()
		jsProt366 := factory365.GetProtocol(mbTrans363)
		argvalue0 := aurora.NewTaskQuery()
		err367 := argvalue0.Read(jsProt366)
		if err367 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.QueryRecovery(context.Background(), value0))
		fmt.Print("\n")
		break
	case "deleteRecoveryTasks":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "DeleteRecoveryTasks requires 1 args")
			flag.Usage()
		}
		arg368 := flag.Arg(1)
		mbTrans369 := thrift.NewTMemoryBufferLen(len(arg368))
		defer mbTrans369.Close()
		_, err370 := mbTrans369.WriteString(arg368)
		if err370 != nil {
			Usage()
			return
		}
		factory371 := thrift.NewTJSONProtocolFactory()
		jsProt372 := factory371.GetProtocol(mbTrans369)
		argvalue0 := aurora.NewTaskQuery()
		err373 := argvalue0.Read(jsProt372)
		if err373 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.DeleteRecoveryTasks(context.Background(), value0))
		fmt.Print("\n")
		break
	case "commitRecovery":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "CommitRecovery requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.CommitRecovery(context.Background()))
		fmt.Print("\n")
		break
	case "unloadRecovery":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "UnloadRecovery requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.UnloadRecovery(context.Background()))
		fmt.Print("\n")
		break
	case "startMaintenance":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "StartMaintenance requires 1 args")
			flag.Usage()
		}
		arg374 := flag.Arg(1)
		mbTrans375 := thrift.NewTMemoryBufferLen(len(arg374))
		defer mbTrans375.Close()
		_, err376 := mbTrans375.WriteString(arg374)
		if err376 != nil {
			Usage()
			return
		}
		factory377 := thrift.NewTJSONProtocolFactory()
		jsProt378 := factory377.GetProtocol(mbTrans375)
		argvalue0 := aurora.NewHosts()
		err379 := argvalue0.Read(jsProt378)
		if err379 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.StartMaintenance(context.Background(), value0))
		fmt.Print("\n")
		break
	case "drainHosts":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "DrainHosts requires 1 args")
			flag.Usage()
		}
		arg380 := flag.Arg(1)
		mbTrans381 := thrift.NewTMemoryBufferLen(len(arg380))
		defer mbTrans381.Close()
		_, err382 := mbTrans381.WriteString(arg380)
		if err382 != nil {
			Usage()
			return
		}
		factory383 := thrift.NewTJSONProtocolFactory()
		jsProt384 := factory383.GetProtocol(mbTrans381)
		argvalue0 := aurora.NewHosts()
		err385 := argvalue0.Read(jsProt384)
		if err385 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.DrainHosts(context.Background(), value0))
		fmt.Print("\n")
		break
	case "maintenanceStatus":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "MaintenanceStatus requires 1 args")
			flag.Usage()
		}
		arg386 := flag.Arg(1)
		mbTrans387 := thrift.NewTMemoryBufferLen(len(arg386))
		defer mbTrans387.Close()
		_, err388 := mbTrans387.WriteString(arg386)
		if err388 != nil {
			Usage()
			return
		}
		factory389 := thrift.NewTJSONProtocolFactory()
		jsProt390 := factory389.GetProtocol(mbTrans387)
		argvalue0 := aurora.NewHosts()
		err391 := argvalue0.Read(jsProt390)
		if err391 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.MaintenanceStatus(context.Background(), value0))
		fmt.Print("\n")
		break
	case "endMaintenance":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "EndMaintenance requires 1 args")
			flag.Usage()
		}
		arg392 := flag.Arg(1)
		mbTrans393 := thrift.NewTMemoryBufferLen(len(arg392))
		defer mbTrans393.Close()
		_, err394 := mbTrans393.WriteString(arg392)
		if err394 != nil {
			Usage()
			return
		}
		factory395 := thrift.NewTJSONProtocolFactory()
		jsProt396 := factory395.GetProtocol(mbTrans393)
		argvalue0 := aurora.NewHosts()
		err397 := argvalue0.Read(jsProt396)
		if err397 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.EndMaintenance(context.Background(), value0))
		fmt.Print("\n")
		break
	case "slaDrainHosts":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "SlaDrainHosts requires 3 args")
			flag.Usage()
		}
		arg398 := flag.Arg(1)
		mbTrans399 := thrift.NewTMemoryBufferLen(len(arg398))
		defer mbTrans399.Close()
		_, err400 := mbTrans399.WriteString(arg398)
		if err400 != nil {
			Usage()
			return
		}
		factory401 := thrift.NewTJSONProtocolFactory()
		jsProt402 := factory401.GetProtocol(mbTrans399)
		argvalue0 := aurora.NewHosts()
		err403 := argvalue0.Read(jsProt402)
		if err403 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg404 := flag.Arg(2)
		mbTrans405 := thrift.NewTMemoryBufferLen(len(arg404))
		defer mbTrans405.Close()
		_, err406 := mbTrans405.WriteString(arg404)
		if err406 != nil {
			Usage()
			return
		}
		factory407 := thrift.NewTJSONProtocolFactory()
		jsProt408 := factory407.GetProtocol(mbTrans405)
		argvalue1 := aurora.NewSlaPolicy()
		err409 := argvalue1.Read(jsProt408)
		if err409 != nil {
			Usage()
			return
		}
		value1 := argvalue1
		argvalue2, err410 := (strconv.ParseInt(flag.Arg(3), 10, 64))
		if err410 != nil {
			Usage()
			return
		}
		value2 := argvalue2
		fmt.Print(client.SlaDrainHosts(context.Background(), value0, value1, value2))
		fmt.Print("\n")
		break
	case "snapshot":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "Snapshot requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.Snapshot(context.Background()))
		fmt.Print("\n")
		break
	case "triggerExplicitTaskReconciliation":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "TriggerExplicitTaskReconciliation requires 1 args")
			flag.Usage()
		}
		arg411 := flag.Arg(1)
		mbTrans412 := thrift.NewTMemoryBufferLen(len(arg411))
		defer mbTrans412.Close()
		_, err413 := mbTrans412.WriteString(arg411)
		if err413 != nil {
			Usage()
			return
		}
		factory414 := thrift.NewTJSONProtocolFactory()
		jsProt415 := factory414.GetProtocol(mbTrans412)
		argvalue0 := aurora.NewExplicitReconciliationSettings()
		err416 := argvalue0.Read(jsProt415)
		if err416 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.TriggerExplicitTaskReconciliation(context.Background(), value0))
		fmt.Print("\n")
		break
	case "triggerImplicitTaskReconciliation":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "TriggerImplicitTaskReconciliation requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.TriggerImplicitTaskReconciliation(context.Background()))
		fmt.Print("\n")
		break
	case "pruneTasks":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "PruneTasks requires 1 args")
			flag.Usage()
		}
		arg417 := flag.Arg(1)
		mbTrans418 := thrift.NewTMemoryBufferLen(len(arg417))
		defer mbTrans418.Close()
		_, err419 := mbTrans418.WriteString(arg417)
		if err419 != nil {
			Usage()
			return
		}
		factory420 := thrift.NewTJSONProtocolFactory()
		jsProt421 := factory420.GetProtocol(mbTrans418)
		argvalue0 := aurora.NewTaskQuery()
		err422 := argvalue0.Read(jsProt421)
		if err422 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.PruneTasks(context.Background(), value0))
		fmt.Print("\n")
		break
	case "createJob":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "CreateJob requires 1 args")
			flag.Usage()
		}
		arg423 := flag.Arg(1)
		mbTrans424 := thrift.NewTMemoryBufferLen(len(arg423))
		defer mbTrans424.Close()
		_, err425 := mbTrans424.WriteString(arg423)
		if err425 != nil {
			Usage()
			return
		}
		factory426 := thrift.NewTJSONProtocolFactory()
		jsProt427 := factory426.GetProtocol(mbTrans424)
		argvalue0 := aurora.NewJobConfiguration()
		err428 := argvalue0.Read(jsProt427)
		if err428 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.CreateJob(context.Background(), value0))
		fmt.Print("\n")
		break
	case "scheduleCronJob":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ScheduleCronJob requires 1 args")
			flag.Usage()
		}
		arg429 := flag.Arg(1)
		mbTrans430 := thrift.NewTMemoryBufferLen(len(arg429))
		defer mbTrans430.Close()
		_, err431 := mbTrans430.WriteString(arg429)
		if err431 != nil {
			Usage()
			return
		}
		factory432 := thrift.NewTJSONProtocolFactory()
		jsProt433 := factory432.GetProtocol(mbTrans430)
		argvalue0 := aurora.NewJobConfiguration()
		err434 := argvalue0.Read(jsProt433)
		if err434 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.ScheduleCronJob(context.Background(), value0))
		fmt.Print("\n")
		break
	case "descheduleCronJob":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "DescheduleCronJob requires 1 args")
			flag.Usage()
		}
		arg435 := flag.Arg(1)
		mbTrans436 := thrift.NewTMemoryBufferLen(len(arg435))
		defer mbTrans436.Close()
		_, err437 := mbTrans436.WriteString(arg435)
		if err437 != nil {
			Usage()
			return
		}
		factory438 := thrift.NewTJSONProtocolFactory()
		jsProt439 := factory438.GetProtocol(mbTrans436)
		argvalue0 := aurora.NewJobKey()
		err440 := argvalue0.Read(jsProt439)
		if err440 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.DescheduleCronJob(context.Background(), value0))
		fmt.Print("\n")
		break
	case "startCronJob":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "StartCronJob requires 1 args")
			flag.Usage()
		}
		arg441 := flag.Arg(1)
		mbTrans442 := thrift.NewTMemoryBufferLen(len(arg441))
		defer mbTrans442.Close()
		_, err443 := mbTrans442.WriteString(arg441)
		if err443 != nil {
			Usage()
			return
		}
		factory444 := thrift.NewTJSONProtocolFactory()
		jsProt445 := factory444.GetProtocol(mbTrans442)
		argvalue0 := aurora.NewJobKey()
		err446 := argvalue0.Read(jsProt445)
		if err446 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.StartCronJob(context.Background(), value0))
		fmt.Print("\n")
		break
	case "restartShards":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "RestartShards requires 2 args")
			flag.Usage()
		}
		arg447 := flag.Arg(1)
		mbTrans448 := thrift.NewTMemoryBufferLen(len(arg447))
		defer mbTrans448.Close()
		_, err449 := mbTrans448.WriteString(arg447)
		if err449 != nil {
			Usage()
			return
		}
		factory450 := thrift.NewTJSONProtocolFactory()
		jsProt451 := factory450.GetProtocol(mbTrans448)
		argvalue0 := aurora.NewJobKey()
		err452 := argvalue0.Read(jsProt451)
		if err452 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg453 := flag.Arg(2)
		mbTrans454 := thrift.NewTMemoryBufferLen(len(arg453))
		defer mbTrans454.Close()
		_, err455 := mbTrans454.WriteString(arg453)
		if err455 != nil {
			Usage()
			return
		}
		factory456 := thrift.NewTJSONProtocolFactory()
		jsProt457 := factory456.GetProtocol(mbTrans454)
		containerStruct1 := aurora.NewAuroraAdminRestartShardsArgs()
		err458 := containerStruct1.ReadField2(jsProt457)
		if err458 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.ShardIds
		value1 := argvalue1
		fmt.Print(client.RestartShards(context.Background(), value0, value1))
		fmt.Print("\n")
		break
	case "killTasks":
		if flag.NArg()-1 != 3 {
			fmt.Fprintln(os.Stderr, "KillTasks requires 3 args")
			flag.Usage()
		}
		arg459 := flag.Arg(1)
		mbTrans460 := thrift.NewTMemoryBufferLen(len(arg459))
		defer mbTrans460.Close()
		_, err461 := mbTrans460.WriteString(arg459)
		if err461 != nil {
			Usage()
			return
		}
		factory462 := thrift.NewTJSONProtocolFactory()
		jsProt463 := factory462.GetProtocol(mbTrans460)
		argvalue0 := aurora.NewJobKey()
		err464 := argvalue0.Read(jsProt463)
		if err464 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		arg465 := flag.Arg(2)
		mbTrans466 := thrift.NewTMemoryBufferLen(len(arg465))
		defer mbTrans466.Close()
		_, err467 := mbTrans466.WriteString(arg465)
		if err467 != nil {
			Usage()
			return
		}
		factory468 := thrift.NewTJSONProtocolFactory()
		jsProt469 := factory468.GetProtocol(mbTrans466)
		containerStruct1 := aurora.NewAuroraAdminKillTasksArgs()
		err470 := containerStruct1.ReadField2(jsProt469)
		if err470 != nil {
			Usage()
			return
		}
		argvalue1 := containerStruct1.Instances
		value1 := argvalue1
		argvalue2 := flag.Arg(3)
		value2 := argvalue2
		fmt.Print(client.KillTasks(context.Background(), value0, value1, value2))
		fmt.Print("\n")
		break
	case "addInstances":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "AddInstances requires 2 args")
			flag.Usage()
		}
		arg472 := flag.Arg(1)
		mbTrans473 := thrift.NewTMemoryBufferLen(len(arg472))
		defer mbTrans473.Close()
		_, err474 := mbTrans473.WriteString(arg472)
		if err474 != nil {
			Usage()
			return
		}
		factory475 := thrift.NewTJSONProtocolFactory()
		jsProt476 := factory475.GetProtocol(mbTrans473)
		argvalue0 := aurora.NewInstanceKey()
		err477 := argvalue0.Read(jsProt476)
		if err477 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		tmp1, err478 := (strconv.Atoi(flag.Arg(2)))
		if err478 != nil {
			Usage()
			return
		}
		argvalue1 := int32(tmp1)
		value1 := argvalue1
		fmt.Print(client.AddInstances(context.Background(), value0, value1))
		fmt.Print("\n")
		break
	case "replaceCronTemplate":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "ReplaceCronTemplate requires 1 args")
			flag.Usage()
		}
		arg479 := flag.Arg(1)
		mbTrans480 := thrift.NewTMemoryBufferLen(len(arg479))
		defer mbTrans480.Close()
		_, err481 := mbTrans480.WriteString(arg479)
		if err481 != nil {
			Usage()
			return
		}
		factory482 := thrift.NewTJSONProtocolFactory()
		jsProt483 := factory482.GetProtocol(mbTrans480)
		argvalue0 := aurora.NewJobConfiguration()
		err484 := argvalue0.Read(jsProt483)
		if err484 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.ReplaceCronTemplate(context.Background(), value0))
		fmt.Print("\n")
		break
	case "startJobUpdate":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "StartJobUpdate requires 2 args")
			flag.Usage()
		}
		arg485 := flag.Arg(1)
		mbTrans486 := thrift.NewTMemoryBufferLen(len(arg485))
		defer mbTrans486.Close()
		_, err487 := mbTrans486.WriteString(arg485)
		if err487 != nil {
			Usage()
			return
		}
		factory488 := thrift.NewTJSONProtocolFactory()
		jsProt489 := factory488.GetProtocol(mbTrans486)
		argvalue0 := aurora.NewJobUpdateRequest()
		err490 := argvalue0.Read(jsProt489)
		if err490 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.StartJobUpdate(context.Background(), value0, value1))
		fmt.Print("\n")
		break
	case "pauseJobUpdate":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "PauseJobUpdate requires 2 args")
			flag.Usage()
		}
		arg492 := flag.Arg(1)
		mbTrans493 := thrift.NewTMemoryBufferLen(len(arg492))
		defer mbTrans493.Close()
		_, err494 := mbTrans493.WriteString(arg492)
		if err494 != nil {
			Usage()
			return
		}
		factory495 := thrift.NewTJSONProtocolFactory()
		jsProt496 := factory495.GetProtocol(mbTrans493)
		argvalue0 := aurora.NewJobUpdateKey()
		err497 := argvalue0.Read(jsProt496)
		if err497 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.PauseJobUpdate(context.Background(), value0, value1))
		fmt.Print("\n")
		break
	case "resumeJobUpdate":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "ResumeJobUpdate requires 2 args")
			flag.Usage()
		}
		arg499 := flag.Arg(1)
		mbTrans500 := thrift.NewTMemoryBufferLen(len(arg499))
		defer mbTrans500.Close()
		_, err501 := mbTrans500.WriteString(arg499)
		if err501 != nil {
			Usage()
			return
		}
		factory502 := thrift.NewTJSONProtocolFactory()
		jsProt503 := factory502.GetProtocol(mbTrans500)
		argvalue0 := aurora.NewJobUpdateKey()
		err504 := argvalue0.Read(jsProt503)
		if err504 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.ResumeJobUpdate(context.Background(), value0, value1))
		fmt.Print("\n")
		break
	case "abortJobUpdate":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "AbortJobUpdate requires 2 args")
			flag.Usage()
		}
		arg506 := flag.Arg(1)
		mbTrans507 := thrift.NewTMemoryBufferLen(len(arg506))
		defer mbTrans507.Close()
		_, err508 := mbTrans507.WriteString(arg506)
		if err508 != nil {
			Usage()
			return
		}
		factory509 := thrift.NewTJSONProtocolFactory()
		jsProt510 := factory509.GetProtocol(mbTrans507)
		argvalue0 := aurora.NewJobUpdateKey()
		err511 := argvalue0.Read(jsProt510)
		if err511 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.AbortJobUpdate(context.Background(), value0, value1))
		fmt.Print("\n")
		break
	case "rollbackJobUpdate":
		if flag.NArg()-1 != 2 {
			fmt.Fprintln(os.Stderr, "RollbackJobUpdate requires 2 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.NewTJSONProtocolFactory()
		jsProt517 := factory516.GetProtocol(mbTrans514)
		argvalue0 := aurora.NewJobUpdateKey()
		err518 := argvalue0.Read(jsProt517)
		if err518 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		argvalue1 := flag.Arg(2)
		value1 := argvalue1
		fmt.Print(client.RollbackJobUpdate(context.Background(), value0, value1))
		fmt.Print("\n")
		break
	case "pulseJobUpdate":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "PulseJobUpdate requires 1 args")
			flag.Usage()
		}
		arg520 := flag.Arg(1)
		mbTrans521 := thrift.NewTMemoryBufferLen(len(arg520))
		defer mbTrans521.Close()
		_, err522 := mbTrans521.WriteString(arg520)
		if err522 != nil {
			Usage()
			return
		}
		factory523 := thrift.NewTJSONProtocolFactory()
		jsProt524 := factory523.GetProtocol(mbTrans521)
		argvalue0 := aurora.NewJobUpdateKey()
		err525 := argvalue0.Read(jsProt524)
		if err525 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.PulseJobUpdate(context.Background(), value0))
		fmt.Print("\n")
		break
	case "getRoleSummary":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "GetRoleSummary requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.GetRoleSummary(context.Background()))
		fmt.Print("\n")
		break
	case "getJobSummary":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetJobSummary requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetJobSummary(context.Background(), value0))
		fmt.Print("\n")
		break
	case "getTasksStatus":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetTasksStatus requires 1 args")
			flag.Usage()
		}
		arg527 := flag.Arg(1)
		mbTrans528 := thrift.NewTMemoryBufferLen(len(arg527))
		defer mbTrans528.Close()
		_, err529 := mbTrans528.WriteString(arg527)
		if err529 != nil {
			Usage()
			return
		}
		factory530 := thrift.NewTJSONProtocolFactory()
		jsProt531 := factory530.GetProtocol(mbTrans528)
		argvalue0 := aurora.NewTaskQuery()
		err532 := argvalue0.Read(jsProt531)
		if err532 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetTasksStatus(context.Background(), value0))
		fmt.Print("\n")
		break
	case "getTasksWithoutConfigs":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetTasksWithoutConfigs requires 1 args")
			flag.Usage()
		}
		arg533 := flag.Arg(1)
		mbTrans534 := thrift.NewTMemoryBufferLen(len(arg533))
		defer mbTrans534.Close()
		_, err535 := mbTrans534.WriteString(arg533)
		if err535 != nil {
			Usage()
			return
		}
		factory536 := thrift.NewTJSONProtocolFactory()
		jsProt537 := factory536.GetProtocol(mbTrans534)
		argvalue0 := aurora.NewTaskQuery()
		err538 := argvalue0.Read(jsProt537)
		if err538 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetTasksWithoutConfigs(context.Background(), value0))
		fmt.Print("\n")
		break
	case "getPendingReason":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetPendingReason requires 1 args")
			flag.Usage()
		}
		arg539 := flag.Arg(1)
		mbTrans540 := thrift.NewTMemoryBufferLen(len(arg539))
		defer mbTrans540.Close()
		_, err541 := mbTrans540.WriteString(arg539)
		if err541 != nil {
			Usage()
			return
		}
		factory542 := thrift.NewTJSONProtocolFactory()
		jsProt543 := factory542.GetProtocol(mbTrans540)
		argvalue0 := aurora.NewTaskQuery()
		err544 := argvalue0.Read(jsProt543)
		if err544 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetPendingReason(context.Background(), value0))
		fmt.Print("\n")
		break
	case "getConfigSummary":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetConfigSummary requires 1 args")
			flag.Usage()
		}
		arg545 := flag.Arg(1)
		mbTrans546 := thrift.NewTMemoryBufferLen(len(arg545))
		defer mbTrans546.Close()
		_, err547 := mbTrans546.WriteString(arg545)
		if err547 != nil {
			Usage()
			return
		}
		factory548 := thrift.NewTJSONProtocolFactory()
		jsProt549 := factory548.GetProtocol(mbTrans546)
		argvalue0 := aurora.NewJobKey()
		err550 := argvalue0.Read(jsProt549)
		if err550 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetConfigSummary(context.Background(), value0))
		fmt.Print("\n")
		break
	case "getJobs":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetJobs requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetJobs(context.Background(), value0))
		fmt.Print("\n")
		break
	case "getQuota":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetQuota requires 1 args")
			flag.Usage()
		}
		argvalue0 := flag.Arg(1)
		value0 := argvalue0
		fmt.Print(client.GetQuota(context.Background(), value0))
		fmt.Print("\n")
		break
	case "populateJobConfig":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "PopulateJobConfig requires 1 args")
			flag.Usage()
		}
		arg553 := flag.Arg(1)
		mbTrans554 := thrift.NewTMemoryBufferLen(len(arg553))
		defer mbTrans554.Close()
		_, err555 := mbTrans554.WriteString(arg553)
		if err555 != nil {
			Usage()
			return
		}
		factory556 := thrift.NewTJSONProtocolFactory()
		jsProt557 := factory556.GetProtocol(mbTrans554)
		argvalue0 := aurora.NewJobConfiguration()
		err558 := argvalue0.Read(jsProt557)
		if err558 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.PopulateJobConfig(context.Background(), value0))
		fmt.Print("\n")
		break
	case "getJobUpdateSummaries":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetJobUpdateSummaries requires 1 args")
			flag.Usage()
		}
		arg559 := flag.Arg(1)
		mbTrans560 := thrift.NewTMemoryBufferLen(len(arg559))
		defer mbTrans560.Close()
		_, err561 := mbTrans560.WriteString(arg559)
		if err561 != nil {
			Usage()
			return
		}
		factory562 := thrift.NewTJSONProtocolFactory()
		jsProt563 := factory562.GetProtocol(mbTrans560)
		argvalue0 := aurora.NewJobUpdateQuery()
		err564 := argvalue0.Read(jsProt563)
		if err564 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetJobUpdateSummaries(context.Background(), value0))
		fmt.Print("\n")
		break
	case "getJobUpdateDetails":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetJobUpdateDetails requires 1 args")
			flag.Usage()
		}
		arg565 := flag.Arg(1)
		mbTrans566 := thrift.NewTMemoryBufferLen(len(arg565))
		defer mbTrans566.Close()
		_, err567 := mbTrans566.WriteString(arg565)
		if err567 != nil {
			Usage()
			return
		}
		factory568 := thrift.NewTJSONProtocolFactory()
		jsProt569 := factory568.GetProtocol(mbTrans566)
		argvalue0 := aurora.NewJobUpdateQuery()
		err570 := argvalue0.Read(jsProt569)
		if err570 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetJobUpdateDetails(context.Background(), value0))
		fmt.Print("\n")
		break
	case "getJobUpdateDiff":
		if flag.NArg()-1 != 1 {
			fmt.Fprintln(os.Stderr, "GetJobUpdateDiff requires 1 args")
			flag.Usage()
		}
		arg571 := flag.Arg(1)
		mbTrans572 := thrift.NewTMemoryBufferLen(len(arg571))
		defer mbTrans572.Close()
		_, err573 := mbTrans572.WriteString(arg571)
		if err573 != nil {
			Usage()
			return
		}
		factory574 := thrift.NewTJSONProtocolFactory()
		jsProt575 := factory574.GetProtocol(mbTrans572)
		argvalue0 := aurora.NewJobUpdateRequest()
		err576 := argvalue0.Read(jsProt575)
		if err576 != nil {
			Usage()
			return
		}
		value0 := argvalue0
		fmt.Print(client.GetJobUpdateDiff(context.Background(), value0))
		fmt.Print("\n")
		break
	case "getTierConfigs":
		if flag.NArg()-1 != 0 {
			fmt.Fprintln(os.Stderr, "GetTierConfigs requires 0 args")
			flag.Usage()
		}
		fmt.Print(client.GetTierConfigs(context.Background()))
		fmt.Print("\n")
		break
	case "":
		Usage()
		break
	default:
		fmt.Fprintln(os.Stderr, "Invalid function ", cmd)
	}
}
