#!/usr/bin/env python
#
# Autogenerated by Thrift Compiler (0.14.1)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py
#

import pprint
import sys

if sys.version_info[0] > 2:
    from urllib.parse import urlparse
else:
    from urlparse import urlparse

from thrift.protocol.TBinaryProtocol import TBinaryProtocol
from thrift.transport import THttpClient, TSocket, TSSLSocket, TTransport

from iotdb.thrift.confignode import IConfigNodeRPCService
from iotdb.thrift.confignode.ttypes import *

if len(sys.argv) <= 1 or sys.argv[1] == '--help':
    print('')
    print('Usage: ' + sys.argv[0] + ' [-h host[:port]] [-u url] [-f[ramed]] [-s[sl]] [-novalidate] [-ca_certs certs] [-keyfile keyfile] [-certfile certfile] function [arg1 [arg2...]]')
    print('')
    print('Functions:')
    print('  TGetClusterIdResp getClusterId()')
    print('  TDataNodeRegisterResp registerDataNode(TDataNodeRegisterReq req)')
    print('  TDataNodeRestartResp restartDataNode(TDataNodeRestartReq req)')
    print('  TAINodeRegisterResp registerAINode(TAINodeRegisterReq req)')
    print('  TAINodeRestartResp restartAINode(TAINodeRestartReq req)')
    print('  TSStatus removeAINode(TAINodeRemoveReq req)')
    print('  TShowAINodesResp showAINodes()')
    print('  TAINodeConfigurationResp getAINodeConfiguration(i32 aiNodeId)')
    print('  TGetAINodeLocationResp getAINodeLocation()')
    print('  TSystemConfigurationResp getSystemConfiguration()')
    print('  TDataNodeRemoveResp removeDataNode(TDataNodeRemoveReq req)')
    print('  TSStatus reportDataNodeShutdown(TDataNodeLocation dataNodeLocation)')
    print('  TDataNodeConfigurationResp getDataNodeConfiguration(i32 dataNodeId)')
    print('  TSStatus setDatabase(TDatabaseSchema databaseSchema)')
    print('  TSStatus alterDatabase(TDatabaseSchema databaseSchema)')
    print('  TSStatus deleteDatabase(TDeleteDatabaseReq req)')
    print('  TSStatus deleteDatabases(TDeleteDatabasesReq req)')
    print('  TSStatus setSchemaReplicationFactor(TSetSchemaReplicationFactorReq req)')
    print('  TSStatus setDataReplicationFactor(TSetDataReplicationFactorReq req)')
    print('  TSStatus setTimePartitionInterval(TSetTimePartitionIntervalReq req)')
    print('  TCountDatabaseResp countMatchedDatabases(TGetDatabaseReq req)')
    print('  TDatabaseSchemaResp getMatchedDatabaseSchemas(TGetDatabaseReq req)')
    print('  TSStatus callSpecialProcedure(TTestOperation operation)')
    print('  TSchemaPartitionTableResp getSchemaPartitionTable(TSchemaPartitionReq req)')
    print('  TSchemaPartitionTableResp getSchemaPartitionTableWithSlots( dbSlotMap)')
    print('  TSchemaPartitionTableResp getOrCreateSchemaPartitionTable(TSchemaPartitionReq req)')
    print('  TSchemaPartitionTableResp getOrCreateSchemaPartitionTableWithSlots( dbSlotMap)')
    print('  TSchemaNodeManagementResp getSchemaNodeManagementPartition(TSchemaNodeManagementReq req)')
    print('  TDataPartitionTableResp getDataPartitionTable(TDataPartitionReq req)')
    print('  TDataPartitionTableResp getOrCreateDataPartitionTable(TDataPartitionReq req)')
    print('  TSStatus operatePermission(TAuthorizerReq req)')
    print('  TSStatus operateRPermission(TAuthorizerRelationalReq req)')
    print('  TAuthorizerResp queryPermission(TAuthorizerReq req)')
    print('  TAuthorizerResp queryRPermission(TAuthorizerRelationalReq req)')
    print('  TPermissionInfoResp login(TLoginReq req)')
    print('  TPermissionInfoResp checkUserPrivileges(TCheckUserPrivilegesReq req)')
    print('  TAuthizedPatternTreeResp fetchAuthizedPatternTree(TCheckUserPrivilegesReq req)')
    print('  TPermissionInfoResp checkRoleOfUser(TAuthorizerReq req)')
    print('  TPermissionInfoResp getUser(string userName)')
    print('  TConfigNodeRegisterResp registerConfigNode(TConfigNodeRegisterReq req)')
    print('  TSStatus addConsensusGroup(TAddConsensusGroupReq req)')
    print('  TSStatus notifyRegisterSuccess()')
    print('  TSStatus removeConfigNode(TConfigNodeLocation configNodeLocation)')
    print('  TSStatus deleteConfigNodePeer(TConfigNodeLocation configNodeLocation)')
    print('  TSStatus reportConfigNodeShutdown(TConfigNodeLocation configNodeLocation)')
    print('  TSStatus stopAndClearConfigNode(TConfigNodeLocation configNodeLocation)')
    print('  TConfigNodeHeartbeatResp getConfigNodeHeartBeat(TConfigNodeHeartbeatReq req)')
    print('  TSStatus createFunction(TCreateFunctionReq req)')
    print('  TSStatus dropFunction(TDropFunctionReq req)')
    print('  TGetUDFTableResp getUDFTable(TGetUdfTableReq req)')
    print('  TGetJarInListResp getUDFJar(TGetJarInListReq req)')
    print('  TSStatus createTrigger(TCreateTriggerReq req)')
    print('  TSStatus dropTrigger(TDropTriggerReq req)')
    print('  TGetLocationForTriggerResp getLocationOfStatefulTrigger(string triggerName)')
    print('  TGetTriggerTableResp getTriggerTable()')
    print('  TGetTriggerTableResp getStatefulTriggerTable()')
    print('  TGetJarInListResp getTriggerJar(TGetJarInListReq req)')
    print('  TSStatus createPipePlugin(TCreatePipePluginReq req)')
    print('  TSStatus dropPipePlugin(TDropPipePluginReq req)')
    print('  TGetPipePluginTableResp getPipePluginTable()')
    print('  TGetPipePluginTableResp getPipePluginTableExtended(TShowPipePluginReq req)')
    print('  TGetJarInListResp getPipePluginJar(TGetJarInListReq req)')
    print('  TShowTTLResp showTTL(TShowTTLReq req)')
    print('  TSStatus setTTL(TSetTTLReq req)')
    print('  TSStatus merge()')
    print('  TSStatus flush(TFlushReq req)')
    print('  TSStatus clearCache( cacheClearOptions)')
    print('  TSStatus setConfiguration(TSetConfigurationReq req)')
    print('  TShowConfigurationResp showConfiguration(i32 nodeId)')
    print('  TSStatus startRepairData()')
    print('  TSStatus stopRepairData()')
    print('  TSStatus submitLoadConfigurationTask()')
    print('  TSStatus loadConfiguration()')
    print('  TSStatus setSystemStatus(string status)')
    print('  TSStatus setDataNodeStatus(TSetDataNodeStatusReq req)')
    print('  TSStatus migrateRegion(TMigrateRegionReq req)')
    print('  TSStatus reconstructRegion(TReconstructRegionReq req)')
    print('  TSStatus extendRegion(TExtendRegionReq req)')
    print('  TSStatus removeRegion(TRemoveRegionReq req)')
    print('  TSStatus killQuery(string queryId, i32 dataNodeId)')
    print('  TGetDataNodeLocationsResp getReadableDataNodeLocations()')
    print('  TShowClusterResp showCluster()')
    print('  TShowVariablesResp showVariables()')
    print('  TShowDataNodesResp showDataNodes()')
    print('  TShowDataNodes4InformationSchemaResp showDataNodes4InformationSchema()')
    print('  TShowConfigNodesResp showConfigNodes()')
    print('  TShowConfigNodes4InformationSchemaResp showConfigNodes4InformationSchema()')
    print('  TShowDatabaseResp showDatabase(TGetDatabaseReq req)')
    print('  TTestConnectionResp submitTestConnectionTask(TNodeLocations nodeLocations)')
    print('  TTestConnectionResp submitTestConnectionTaskToLeader()')
    print('  TSStatus testConnectionEmptyRPC()')
    print('  TShowRegionResp showRegion(TShowRegionReq req)')
    print('  TRegionRouteMapResp getLatestRegionRouteMap()')
    print('  TSStatus createSchemaTemplate(TCreateSchemaTemplateReq req)')
    print('  TGetAllTemplatesResp getAllTemplates()')
    print('  TGetTemplateResp getTemplate(string req)')
    print('  TSStatus setSchemaTemplate(TSetSchemaTemplateReq req)')
    print('  TGetPathsSetTemplatesResp getPathsSetTemplate(TGetPathsSetTemplatesReq req)')
    print('  TSStatus deactivateSchemaTemplate(TDeactivateSchemaTemplateReq req)')
    print('  TSStatus unsetSchemaTemplate(TUnsetSchemaTemplateReq req)')
    print('  TSStatus dropSchemaTemplate(string req)')
    print('  TSStatus alterSchemaTemplate(TAlterSchemaTemplateReq req)')
    print('  TSStatus deleteTimeSeries(TDeleteTimeSeriesReq req)')
    print('  TSStatus deleteLogicalView(TDeleteLogicalViewReq req)')
    print('  TSStatus alterLogicalView(TAlterLogicalViewReq req)')
    print('  TSStatus createPipe(TCreatePipeReq req)')
    print('  TSStatus alterPipe(TAlterPipeReq req)')
    print('  TSStatus startPipe(string pipeName)')
    print('  TSStatus startPipeExtended(TStartPipeReq req)')
    print('  TSStatus stopPipe(string pipeName)')
    print('  TSStatus stopPipeExtended(TStopPipeReq req)')
    print('  TSStatus dropPipe(string pipeName)')
    print('  TSStatus dropPipeExtended(TDropPipeReq req)')
    print('  TShowPipeResp showPipe(TShowPipeReq req)')
    print('  TGetAllPipeInfoResp getAllPipeInfo()')
    print('  TPipeConfigTransferResp handleTransferConfigPlan(TPipeConfigTransferReq req)')
    print('  TSStatus handlePipeConfigClientExit(string clientId)')
    print('  TSStatus createTopic(TCreateTopicReq req)')
    print('  TSStatus dropTopic(string topicName)')
    print('  TSStatus dropTopicExtended(TDropTopicReq req)')
    print('  TShowTopicResp showTopic(TShowTopicReq req)')
    print('  TGetAllTopicInfoResp getAllTopicInfo()')
    print('  TSStatus createConsumer(TCreateConsumerReq req)')
    print('  TSStatus closeConsumer(TCloseConsumerReq req)')
    print('  TSStatus createSubscription(TSubscribeReq req)')
    print('  TSStatus dropSubscription(TUnsubscribeReq req)')
    print('  TSStatus dropSubscriptionById(TDropSubscriptionReq req)')
    print('  TShowSubscriptionResp showSubscription(TShowSubscriptionReq req)')
    print('  TGetAllSubscriptionInfoResp getAllSubscriptionInfo()')
    print('  TGetRegionIdResp getRegionId(TGetRegionIdReq req)')
    print('  TGetTimeSlotListResp getTimeSlotList(TGetTimeSlotListReq req)')
    print('  TCountTimeSlotListResp countTimeSlotList(TCountTimeSlotListReq req)')
    print('  TGetSeriesSlotListResp getSeriesSlotList(TGetSeriesSlotListReq req)')
    print('  TSStatus createCQ(TCreateCQReq req)')
    print('  TSStatus dropCQ(TDropCQReq req)')
    print('  TShowCQResp showCQ()')
    print('  TSStatus createModel(TCreateModelReq req)')
    print('  TSStatus dropModel(TDropModelReq req)')
    print('  TGetModelInfoResp getModelInfo(TGetModelInfoReq req)')
    print('  TSStatus updateModelInfo(TUpdateModelInfoReq req)')
    print('  TSStatus setSpaceQuota(TSetSpaceQuotaReq req)')
    print('  TSpaceQuotaResp showSpaceQuota( databases)')
    print('  TSpaceQuotaResp getSpaceQuota()')
    print('  TSStatus setThrottleQuota(TSetThrottleQuotaReq req)')
    print('  TThrottleQuotaResp showThrottleQuota(TShowThrottleReq req)')
    print('  TThrottleQuotaResp getThrottleQuota()')
    print('  TSStatus pushHeartbeat(i32 dataNodeId, TPipeHeartbeatResp resp)')
    print('  TSStatus createTable(string tableInfo)')
    print('  TSStatus alterOrDropTable(TAlterOrDropTableReq req)')
    print('  TShowTableResp showTables(string database, bool isDetails)')
    print('  TShowTable4InformationSchemaResp showTables4InformationSchema()')
    print('  TDescTableResp describeTable(string database, string tableName, bool isDetails)')
    print('  TDescTable4InformationSchemaResp descTables4InformationSchema()')
    print('  TFetchTableResp fetchTables( fetchTableMap)')
    print('  TDeleteTableDeviceResp deleteDevice(TDeleteTableDeviceReq req)')
    print('  TSStatus createTableView(TCreateTableViewReq req)')
    print('')
    sys.exit(0)

pp = pprint.PrettyPrinter(indent=2)
host = 'localhost'
port = 9090
uri = ''
framed = False
ssl = False
validate = True
ca_certs = None
keyfile = None
certfile = None
http = False
argi = 1

if sys.argv[argi] == '-h':
    parts = sys.argv[argi + 1].split(':')
    host = parts[0]
    if len(parts) > 1:
        port = int(parts[1])
    argi += 2

if sys.argv[argi] == '-u':
    url = urlparse(sys.argv[argi + 1])
    parts = url[1].split(':')
    host = parts[0]
    if len(parts) > 1:
        port = int(parts[1])
    else:
        port = 80
    uri = url[2]
    if url[4]:
        uri += '?%s' % url[4]
    http = True
    argi += 2

if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
    framed = True
    argi += 1

if sys.argv[argi] == '-s' or sys.argv[argi] == '-ssl':
    ssl = True
    argi += 1

if sys.argv[argi] == '-novalidate':
    validate = False
    argi += 1

if sys.argv[argi] == '-ca_certs':
    ca_certs = sys.argv[argi+1]
    argi += 2

if sys.argv[argi] == '-keyfile':
    keyfile = sys.argv[argi+1]
    argi += 2

if sys.argv[argi] == '-certfile':
    certfile = sys.argv[argi+1]
    argi += 2

cmd = sys.argv[argi]
args = sys.argv[argi + 1:]

if http:
    transport = THttpClient.THttpClient(host, port, uri)
else:
    if ssl:
        socket = TSSLSocket.TSSLSocket(host, port, validate=validate, ca_certs=ca_certs, keyfile=keyfile, certfile=certfile)
    else:
        socket = TSocket.TSocket(host, port)
    if framed:
        transport = TTransport.TFramedTransport(socket)
    else:
        transport = TTransport.TBufferedTransport(socket)
protocol = TBinaryProtocol(transport)
client = IConfigNodeRPCService.Client(protocol)
transport.open()

if cmd == 'getClusterId':
    if len(args) != 0:
        print('getClusterId requires 0 args')
        sys.exit(1)
    pp.pprint(client.getClusterId())

elif cmd == 'registerDataNode':
    if len(args) != 1:
        print('registerDataNode requires 1 args')
        sys.exit(1)
    pp.pprint(client.registerDataNode(eval(args[0]),))

elif cmd == 'restartDataNode':
    if len(args) != 1:
        print('restartDataNode requires 1 args')
        sys.exit(1)
    pp.pprint(client.restartDataNode(eval(args[0]),))

elif cmd == 'registerAINode':
    if len(args) != 1:
        print('registerAINode requires 1 args')
        sys.exit(1)
    pp.pprint(client.registerAINode(eval(args[0]),))

elif cmd == 'restartAINode':
    if len(args) != 1:
        print('restartAINode requires 1 args')
        sys.exit(1)
    pp.pprint(client.restartAINode(eval(args[0]),))

elif cmd == 'removeAINode':
    if len(args) != 1:
        print('removeAINode requires 1 args')
        sys.exit(1)
    pp.pprint(client.removeAINode(eval(args[0]),))

elif cmd == 'showAINodes':
    if len(args) != 0:
        print('showAINodes requires 0 args')
        sys.exit(1)
    pp.pprint(client.showAINodes())

elif cmd == 'getAINodeConfiguration':
    if len(args) != 1:
        print('getAINodeConfiguration requires 1 args')
        sys.exit(1)
    pp.pprint(client.getAINodeConfiguration(eval(args[0]),))

elif cmd == 'getAINodeLocation':
    if len(args) != 0:
        print('getAINodeLocation requires 0 args')
        sys.exit(1)
    pp.pprint(client.getAINodeLocation())

elif cmd == 'getSystemConfiguration':
    if len(args) != 0:
        print('getSystemConfiguration requires 0 args')
        sys.exit(1)
    pp.pprint(client.getSystemConfiguration())

elif cmd == 'removeDataNode':
    if len(args) != 1:
        print('removeDataNode requires 1 args')
        sys.exit(1)
    pp.pprint(client.removeDataNode(eval(args[0]),))

elif cmd == 'reportDataNodeShutdown':
    if len(args) != 1:
        print('reportDataNodeShutdown requires 1 args')
        sys.exit(1)
    pp.pprint(client.reportDataNodeShutdown(eval(args[0]),))

elif cmd == 'getDataNodeConfiguration':
    if len(args) != 1:
        print('getDataNodeConfiguration requires 1 args')
        sys.exit(1)
    pp.pprint(client.getDataNodeConfiguration(eval(args[0]),))

elif cmd == 'setDatabase':
    if len(args) != 1:
        print('setDatabase requires 1 args')
        sys.exit(1)
    pp.pprint(client.setDatabase(eval(args[0]),))

elif cmd == 'alterDatabase':
    if len(args) != 1:
        print('alterDatabase requires 1 args')
        sys.exit(1)
    pp.pprint(client.alterDatabase(eval(args[0]),))

elif cmd == 'deleteDatabase':
    if len(args) != 1:
        print('deleteDatabase requires 1 args')
        sys.exit(1)
    pp.pprint(client.deleteDatabase(eval(args[0]),))

elif cmd == 'deleteDatabases':
    if len(args) != 1:
        print('deleteDatabases requires 1 args')
        sys.exit(1)
    pp.pprint(client.deleteDatabases(eval(args[0]),))

elif cmd == 'setSchemaReplicationFactor':
    if len(args) != 1:
        print('setSchemaReplicationFactor requires 1 args')
        sys.exit(1)
    pp.pprint(client.setSchemaReplicationFactor(eval(args[0]),))

elif cmd == 'setDataReplicationFactor':
    if len(args) != 1:
        print('setDataReplicationFactor requires 1 args')
        sys.exit(1)
    pp.pprint(client.setDataReplicationFactor(eval(args[0]),))

elif cmd == 'setTimePartitionInterval':
    if len(args) != 1:
        print('setTimePartitionInterval requires 1 args')
        sys.exit(1)
    pp.pprint(client.setTimePartitionInterval(eval(args[0]),))

elif cmd == 'countMatchedDatabases':
    if len(args) != 1:
        print('countMatchedDatabases requires 1 args')
        sys.exit(1)
    pp.pprint(client.countMatchedDatabases(eval(args[0]),))

elif cmd == 'getMatchedDatabaseSchemas':
    if len(args) != 1:
        print('getMatchedDatabaseSchemas requires 1 args')
        sys.exit(1)
    pp.pprint(client.getMatchedDatabaseSchemas(eval(args[0]),))

elif cmd == 'callSpecialProcedure':
    if len(args) != 1:
        print('callSpecialProcedure requires 1 args')
        sys.exit(1)
    pp.pprint(client.callSpecialProcedure(eval(args[0]),))

elif cmd == 'getSchemaPartitionTable':
    if len(args) != 1:
        print('getSchemaPartitionTable requires 1 args')
        sys.exit(1)
    pp.pprint(client.getSchemaPartitionTable(eval(args[0]),))

elif cmd == 'getSchemaPartitionTableWithSlots':
    if len(args) != 1:
        print('getSchemaPartitionTableWithSlots requires 1 args')
        sys.exit(1)
    pp.pprint(client.getSchemaPartitionTableWithSlots(eval(args[0]),))

elif cmd == 'getOrCreateSchemaPartitionTable':
    if len(args) != 1:
        print('getOrCreateSchemaPartitionTable requires 1 args')
        sys.exit(1)
    pp.pprint(client.getOrCreateSchemaPartitionTable(eval(args[0]),))

elif cmd == 'getOrCreateSchemaPartitionTableWithSlots':
    if len(args) != 1:
        print('getOrCreateSchemaPartitionTableWithSlots requires 1 args')
        sys.exit(1)
    pp.pprint(client.getOrCreateSchemaPartitionTableWithSlots(eval(args[0]),))

elif cmd == 'getSchemaNodeManagementPartition':
    if len(args) != 1:
        print('getSchemaNodeManagementPartition requires 1 args')
        sys.exit(1)
    pp.pprint(client.getSchemaNodeManagementPartition(eval(args[0]),))

elif cmd == 'getDataPartitionTable':
    if len(args) != 1:
        print('getDataPartitionTable requires 1 args')
        sys.exit(1)
    pp.pprint(client.getDataPartitionTable(eval(args[0]),))

elif cmd == 'getOrCreateDataPartitionTable':
    if len(args) != 1:
        print('getOrCreateDataPartitionTable requires 1 args')
        sys.exit(1)
    pp.pprint(client.getOrCreateDataPartitionTable(eval(args[0]),))

elif cmd == 'operatePermission':
    if len(args) != 1:
        print('operatePermission requires 1 args')
        sys.exit(1)
    pp.pprint(client.operatePermission(eval(args[0]),))

elif cmd == 'operateRPermission':
    if len(args) != 1:
        print('operateRPermission requires 1 args')
        sys.exit(1)
    pp.pprint(client.operateRPermission(eval(args[0]),))

elif cmd == 'queryPermission':
    if len(args) != 1:
        print('queryPermission requires 1 args')
        sys.exit(1)
    pp.pprint(client.queryPermission(eval(args[0]),))

elif cmd == 'queryRPermission':
    if len(args) != 1:
        print('queryRPermission requires 1 args')
        sys.exit(1)
    pp.pprint(client.queryRPermission(eval(args[0]),))

elif cmd == 'login':
    if len(args) != 1:
        print('login requires 1 args')
        sys.exit(1)
    pp.pprint(client.login(eval(args[0]),))

elif cmd == 'checkUserPrivileges':
    if len(args) != 1:
        print('checkUserPrivileges requires 1 args')
        sys.exit(1)
    pp.pprint(client.checkUserPrivileges(eval(args[0]),))

elif cmd == 'fetchAuthizedPatternTree':
    if len(args) != 1:
        print('fetchAuthizedPatternTree requires 1 args')
        sys.exit(1)
    pp.pprint(client.fetchAuthizedPatternTree(eval(args[0]),))

elif cmd == 'checkRoleOfUser':
    if len(args) != 1:
        print('checkRoleOfUser requires 1 args')
        sys.exit(1)
    pp.pprint(client.checkRoleOfUser(eval(args[0]),))

elif cmd == 'getUser':
    if len(args) != 1:
        print('getUser requires 1 args')
        sys.exit(1)
    pp.pprint(client.getUser(args[0],))

elif cmd == 'registerConfigNode':
    if len(args) != 1:
        print('registerConfigNode requires 1 args')
        sys.exit(1)
    pp.pprint(client.registerConfigNode(eval(args[0]),))

elif cmd == 'addConsensusGroup':
    if len(args) != 1:
        print('addConsensusGroup requires 1 args')
        sys.exit(1)
    pp.pprint(client.addConsensusGroup(eval(args[0]),))

elif cmd == 'notifyRegisterSuccess':
    if len(args) != 0:
        print('notifyRegisterSuccess requires 0 args')
        sys.exit(1)
    pp.pprint(client.notifyRegisterSuccess())

elif cmd == 'removeConfigNode':
    if len(args) != 1:
        print('removeConfigNode requires 1 args')
        sys.exit(1)
    pp.pprint(client.removeConfigNode(eval(args[0]),))

elif cmd == 'deleteConfigNodePeer':
    if len(args) != 1:
        print('deleteConfigNodePeer requires 1 args')
        sys.exit(1)
    pp.pprint(client.deleteConfigNodePeer(eval(args[0]),))

elif cmd == 'reportConfigNodeShutdown':
    if len(args) != 1:
        print('reportConfigNodeShutdown requires 1 args')
        sys.exit(1)
    pp.pprint(client.reportConfigNodeShutdown(eval(args[0]),))

elif cmd == 'stopAndClearConfigNode':
    if len(args) != 1:
        print('stopAndClearConfigNode requires 1 args')
        sys.exit(1)
    pp.pprint(client.stopAndClearConfigNode(eval(args[0]),))

elif cmd == 'getConfigNodeHeartBeat':
    if len(args) != 1:
        print('getConfigNodeHeartBeat requires 1 args')
        sys.exit(1)
    pp.pprint(client.getConfigNodeHeartBeat(eval(args[0]),))

elif cmd == 'createFunction':
    if len(args) != 1:
        print('createFunction requires 1 args')
        sys.exit(1)
    pp.pprint(client.createFunction(eval(args[0]),))

elif cmd == 'dropFunction':
    if len(args) != 1:
        print('dropFunction requires 1 args')
        sys.exit(1)
    pp.pprint(client.dropFunction(eval(args[0]),))

elif cmd == 'getUDFTable':
    if len(args) != 1:
        print('getUDFTable requires 1 args')
        sys.exit(1)
    pp.pprint(client.getUDFTable(eval(args[0]),))

elif cmd == 'getUDFJar':
    if len(args) != 1:
        print('getUDFJar requires 1 args')
        sys.exit(1)
    pp.pprint(client.getUDFJar(eval(args[0]),))

elif cmd == 'createTrigger':
    if len(args) != 1:
        print('createTrigger requires 1 args')
        sys.exit(1)
    pp.pprint(client.createTrigger(eval(args[0]),))

elif cmd == 'dropTrigger':
    if len(args) != 1:
        print('dropTrigger requires 1 args')
        sys.exit(1)
    pp.pprint(client.dropTrigger(eval(args[0]),))

elif cmd == 'getLocationOfStatefulTrigger':
    if len(args) != 1:
        print('getLocationOfStatefulTrigger requires 1 args')
        sys.exit(1)
    pp.pprint(client.getLocationOfStatefulTrigger(args[0],))

elif cmd == 'getTriggerTable':
    if len(args) != 0:
        print('getTriggerTable requires 0 args')
        sys.exit(1)
    pp.pprint(client.getTriggerTable())

elif cmd == 'getStatefulTriggerTable':
    if len(args) != 0:
        print('getStatefulTriggerTable requires 0 args')
        sys.exit(1)
    pp.pprint(client.getStatefulTriggerTable())

elif cmd == 'getTriggerJar':
    if len(args) != 1:
        print('getTriggerJar requires 1 args')
        sys.exit(1)
    pp.pprint(client.getTriggerJar(eval(args[0]),))

elif cmd == 'createPipePlugin':
    if len(args) != 1:
        print('createPipePlugin requires 1 args')
        sys.exit(1)
    pp.pprint(client.createPipePlugin(eval(args[0]),))

elif cmd == 'dropPipePlugin':
    if len(args) != 1:
        print('dropPipePlugin requires 1 args')
        sys.exit(1)
    pp.pprint(client.dropPipePlugin(eval(args[0]),))

elif cmd == 'getPipePluginTable':
    if len(args) != 0:
        print('getPipePluginTable requires 0 args')
        sys.exit(1)
    pp.pprint(client.getPipePluginTable())

elif cmd == 'getPipePluginTableExtended':
    if len(args) != 1:
        print('getPipePluginTableExtended requires 1 args')
        sys.exit(1)
    pp.pprint(client.getPipePluginTableExtended(eval(args[0]),))

elif cmd == 'getPipePluginJar':
    if len(args) != 1:
        print('getPipePluginJar requires 1 args')
        sys.exit(1)
    pp.pprint(client.getPipePluginJar(eval(args[0]),))

elif cmd == 'showTTL':
    if len(args) != 1:
        print('showTTL requires 1 args')
        sys.exit(1)
    pp.pprint(client.showTTL(eval(args[0]),))

elif cmd == 'setTTL':
    if len(args) != 1:
        print('setTTL requires 1 args')
        sys.exit(1)
    pp.pprint(client.setTTL(eval(args[0]),))

elif cmd == 'merge':
    if len(args) != 0:
        print('merge requires 0 args')
        sys.exit(1)
    pp.pprint(client.merge())

elif cmd == 'flush':
    if len(args) != 1:
        print('flush requires 1 args')
        sys.exit(1)
    pp.pprint(client.flush(eval(args[0]),))

elif cmd == 'clearCache':
    if len(args) != 1:
        print('clearCache requires 1 args')
        sys.exit(1)
    pp.pprint(client.clearCache(eval(args[0]),))

elif cmd == 'setConfiguration':
    if len(args) != 1:
        print('setConfiguration requires 1 args')
        sys.exit(1)
    pp.pprint(client.setConfiguration(eval(args[0]),))

elif cmd == 'showConfiguration':
    if len(args) != 1:
        print('showConfiguration requires 1 args')
        sys.exit(1)
    pp.pprint(client.showConfiguration(eval(args[0]),))

elif cmd == 'startRepairData':
    if len(args) != 0:
        print('startRepairData requires 0 args')
        sys.exit(1)
    pp.pprint(client.startRepairData())

elif cmd == 'stopRepairData':
    if len(args) != 0:
        print('stopRepairData requires 0 args')
        sys.exit(1)
    pp.pprint(client.stopRepairData())

elif cmd == 'submitLoadConfigurationTask':
    if len(args) != 0:
        print('submitLoadConfigurationTask requires 0 args')
        sys.exit(1)
    pp.pprint(client.submitLoadConfigurationTask())

elif cmd == 'loadConfiguration':
    if len(args) != 0:
        print('loadConfiguration requires 0 args')
        sys.exit(1)
    pp.pprint(client.loadConfiguration())

elif cmd == 'setSystemStatus':
    if len(args) != 1:
        print('setSystemStatus requires 1 args')
        sys.exit(1)
    pp.pprint(client.setSystemStatus(args[0],))

elif cmd == 'setDataNodeStatus':
    if len(args) != 1:
        print('setDataNodeStatus requires 1 args')
        sys.exit(1)
    pp.pprint(client.setDataNodeStatus(eval(args[0]),))

elif cmd == 'migrateRegion':
    if len(args) != 1:
        print('migrateRegion requires 1 args')
        sys.exit(1)
    pp.pprint(client.migrateRegion(eval(args[0]),))

elif cmd == 'reconstructRegion':
    if len(args) != 1:
        print('reconstructRegion requires 1 args')
        sys.exit(1)
    pp.pprint(client.reconstructRegion(eval(args[0]),))

elif cmd == 'extendRegion':
    if len(args) != 1:
        print('extendRegion requires 1 args')
        sys.exit(1)
    pp.pprint(client.extendRegion(eval(args[0]),))

elif cmd == 'removeRegion':
    if len(args) != 1:
        print('removeRegion requires 1 args')
        sys.exit(1)
    pp.pprint(client.removeRegion(eval(args[0]),))

elif cmd == 'killQuery':
    if len(args) != 2:
        print('killQuery requires 2 args')
        sys.exit(1)
    pp.pprint(client.killQuery(args[0], eval(args[1]),))

elif cmd == 'getReadableDataNodeLocations':
    if len(args) != 0:
        print('getReadableDataNodeLocations requires 0 args')
        sys.exit(1)
    pp.pprint(client.getReadableDataNodeLocations())

elif cmd == 'showCluster':
    if len(args) != 0:
        print('showCluster requires 0 args')
        sys.exit(1)
    pp.pprint(client.showCluster())

elif cmd == 'showVariables':
    if len(args) != 0:
        print('showVariables requires 0 args')
        sys.exit(1)
    pp.pprint(client.showVariables())

elif cmd == 'showDataNodes':
    if len(args) != 0:
        print('showDataNodes requires 0 args')
        sys.exit(1)
    pp.pprint(client.showDataNodes())

elif cmd == 'showDataNodes4InformationSchema':
    if len(args) != 0:
        print('showDataNodes4InformationSchema requires 0 args')
        sys.exit(1)
    pp.pprint(client.showDataNodes4InformationSchema())

elif cmd == 'showConfigNodes':
    if len(args) != 0:
        print('showConfigNodes requires 0 args')
        sys.exit(1)
    pp.pprint(client.showConfigNodes())

elif cmd == 'showConfigNodes4InformationSchema':
    if len(args) != 0:
        print('showConfigNodes4InformationSchema requires 0 args')
        sys.exit(1)
    pp.pprint(client.showConfigNodes4InformationSchema())

elif cmd == 'showDatabase':
    if len(args) != 1:
        print('showDatabase requires 1 args')
        sys.exit(1)
    pp.pprint(client.showDatabase(eval(args[0]),))

elif cmd == 'submitTestConnectionTask':
    if len(args) != 1:
        print('submitTestConnectionTask requires 1 args')
        sys.exit(1)
    pp.pprint(client.submitTestConnectionTask(eval(args[0]),))

elif cmd == 'submitTestConnectionTaskToLeader':
    if len(args) != 0:
        print('submitTestConnectionTaskToLeader requires 0 args')
        sys.exit(1)
    pp.pprint(client.submitTestConnectionTaskToLeader())

elif cmd == 'testConnectionEmptyRPC':
    if len(args) != 0:
        print('testConnectionEmptyRPC requires 0 args')
        sys.exit(1)
    pp.pprint(client.testConnectionEmptyRPC())

elif cmd == 'showRegion':
    if len(args) != 1:
        print('showRegion requires 1 args')
        sys.exit(1)
    pp.pprint(client.showRegion(eval(args[0]),))

elif cmd == 'getLatestRegionRouteMap':
    if len(args) != 0:
        print('getLatestRegionRouteMap requires 0 args')
        sys.exit(1)
    pp.pprint(client.getLatestRegionRouteMap())

elif cmd == 'createSchemaTemplate':
    if len(args) != 1:
        print('createSchemaTemplate requires 1 args')
        sys.exit(1)
    pp.pprint(client.createSchemaTemplate(eval(args[0]),))

elif cmd == 'getAllTemplates':
    if len(args) != 0:
        print('getAllTemplates requires 0 args')
        sys.exit(1)
    pp.pprint(client.getAllTemplates())

elif cmd == 'getTemplate':
    if len(args) != 1:
        print('getTemplate requires 1 args')
        sys.exit(1)
    pp.pprint(client.getTemplate(args[0],))

elif cmd == 'setSchemaTemplate':
    if len(args) != 1:
        print('setSchemaTemplate requires 1 args')
        sys.exit(1)
    pp.pprint(client.setSchemaTemplate(eval(args[0]),))

elif cmd == 'getPathsSetTemplate':
    if len(args) != 1:
        print('getPathsSetTemplate requires 1 args')
        sys.exit(1)
    pp.pprint(client.getPathsSetTemplate(eval(args[0]),))

elif cmd == 'deactivateSchemaTemplate':
    if len(args) != 1:
        print('deactivateSchemaTemplate requires 1 args')
        sys.exit(1)
    pp.pprint(client.deactivateSchemaTemplate(eval(args[0]),))

elif cmd == 'unsetSchemaTemplate':
    if len(args) != 1:
        print('unsetSchemaTemplate requires 1 args')
        sys.exit(1)
    pp.pprint(client.unsetSchemaTemplate(eval(args[0]),))

elif cmd == 'dropSchemaTemplate':
    if len(args) != 1:
        print('dropSchemaTemplate requires 1 args')
        sys.exit(1)
    pp.pprint(client.dropSchemaTemplate(args[0],))

elif cmd == 'alterSchemaTemplate':
    if len(args) != 1:
        print('alterSchemaTemplate requires 1 args')
        sys.exit(1)
    pp.pprint(client.alterSchemaTemplate(eval(args[0]),))

elif cmd == 'deleteTimeSeries':
    if len(args) != 1:
        print('deleteTimeSeries requires 1 args')
        sys.exit(1)
    pp.pprint(client.deleteTimeSeries(eval(args[0]),))

elif cmd == 'deleteLogicalView':
    if len(args) != 1:
        print('deleteLogicalView requires 1 args')
        sys.exit(1)
    pp.pprint(client.deleteLogicalView(eval(args[0]),))

elif cmd == 'alterLogicalView':
    if len(args) != 1:
        print('alterLogicalView requires 1 args')
        sys.exit(1)
    pp.pprint(client.alterLogicalView(eval(args[0]),))

elif cmd == 'createPipe':
    if len(args) != 1:
        print('createPipe requires 1 args')
        sys.exit(1)
    pp.pprint(client.createPipe(eval(args[0]),))

elif cmd == 'alterPipe':
    if len(args) != 1:
        print('alterPipe requires 1 args')
        sys.exit(1)
    pp.pprint(client.alterPipe(eval(args[0]),))

elif cmd == 'startPipe':
    if len(args) != 1:
        print('startPipe requires 1 args')
        sys.exit(1)
    pp.pprint(client.startPipe(args[0],))

elif cmd == 'startPipeExtended':
    if len(args) != 1:
        print('startPipeExtended requires 1 args')
        sys.exit(1)
    pp.pprint(client.startPipeExtended(eval(args[0]),))

elif cmd == 'stopPipe':
    if len(args) != 1:
        print('stopPipe requires 1 args')
        sys.exit(1)
    pp.pprint(client.stopPipe(args[0],))

elif cmd == 'stopPipeExtended':
    if len(args) != 1:
        print('stopPipeExtended requires 1 args')
        sys.exit(1)
    pp.pprint(client.stopPipeExtended(eval(args[0]),))

elif cmd == 'dropPipe':
    if len(args) != 1:
        print('dropPipe requires 1 args')
        sys.exit(1)
    pp.pprint(client.dropPipe(args[0],))

elif cmd == 'dropPipeExtended':
    if len(args) != 1:
        print('dropPipeExtended requires 1 args')
        sys.exit(1)
    pp.pprint(client.dropPipeExtended(eval(args[0]),))

elif cmd == 'showPipe':
    if len(args) != 1:
        print('showPipe requires 1 args')
        sys.exit(1)
    pp.pprint(client.showPipe(eval(args[0]),))

elif cmd == 'getAllPipeInfo':
    if len(args) != 0:
        print('getAllPipeInfo requires 0 args')
        sys.exit(1)
    pp.pprint(client.getAllPipeInfo())

elif cmd == 'handleTransferConfigPlan':
    if len(args) != 1:
        print('handleTransferConfigPlan requires 1 args')
        sys.exit(1)
    pp.pprint(client.handleTransferConfigPlan(eval(args[0]),))

elif cmd == 'handlePipeConfigClientExit':
    if len(args) != 1:
        print('handlePipeConfigClientExit requires 1 args')
        sys.exit(1)
    pp.pprint(client.handlePipeConfigClientExit(args[0],))

elif cmd == 'createTopic':
    if len(args) != 1:
        print('createTopic requires 1 args')
        sys.exit(1)
    pp.pprint(client.createTopic(eval(args[0]),))

elif cmd == 'dropTopic':
    if len(args) != 1:
        print('dropTopic requires 1 args')
        sys.exit(1)
    pp.pprint(client.dropTopic(args[0],))

elif cmd == 'dropTopicExtended':
    if len(args) != 1:
        print('dropTopicExtended requires 1 args')
        sys.exit(1)
    pp.pprint(client.dropTopicExtended(eval(args[0]),))

elif cmd == 'showTopic':
    if len(args) != 1:
        print('showTopic requires 1 args')
        sys.exit(1)
    pp.pprint(client.showTopic(eval(args[0]),))

elif cmd == 'getAllTopicInfo':
    if len(args) != 0:
        print('getAllTopicInfo requires 0 args')
        sys.exit(1)
    pp.pprint(client.getAllTopicInfo())

elif cmd == 'createConsumer':
    if len(args) != 1:
        print('createConsumer requires 1 args')
        sys.exit(1)
    pp.pprint(client.createConsumer(eval(args[0]),))

elif cmd == 'closeConsumer':
    if len(args) != 1:
        print('closeConsumer requires 1 args')
        sys.exit(1)
    pp.pprint(client.closeConsumer(eval(args[0]),))

elif cmd == 'createSubscription':
    if len(args) != 1:
        print('createSubscription requires 1 args')
        sys.exit(1)
    pp.pprint(client.createSubscription(eval(args[0]),))

elif cmd == 'dropSubscription':
    if len(args) != 1:
        print('dropSubscription requires 1 args')
        sys.exit(1)
    pp.pprint(client.dropSubscription(eval(args[0]),))

elif cmd == 'dropSubscriptionById':
    if len(args) != 1:
        print('dropSubscriptionById requires 1 args')
        sys.exit(1)
    pp.pprint(client.dropSubscriptionById(eval(args[0]),))

elif cmd == 'showSubscription':
    if len(args) != 1:
        print('showSubscription requires 1 args')
        sys.exit(1)
    pp.pprint(client.showSubscription(eval(args[0]),))

elif cmd == 'getAllSubscriptionInfo':
    if len(args) != 0:
        print('getAllSubscriptionInfo requires 0 args')
        sys.exit(1)
    pp.pprint(client.getAllSubscriptionInfo())

elif cmd == 'getRegionId':
    if len(args) != 1:
        print('getRegionId requires 1 args')
        sys.exit(1)
    pp.pprint(client.getRegionId(eval(args[0]),))

elif cmd == 'getTimeSlotList':
    if len(args) != 1:
        print('getTimeSlotList requires 1 args')
        sys.exit(1)
    pp.pprint(client.getTimeSlotList(eval(args[0]),))

elif cmd == 'countTimeSlotList':
    if len(args) != 1:
        print('countTimeSlotList requires 1 args')
        sys.exit(1)
    pp.pprint(client.countTimeSlotList(eval(args[0]),))

elif cmd == 'getSeriesSlotList':
    if len(args) != 1:
        print('getSeriesSlotList requires 1 args')
        sys.exit(1)
    pp.pprint(client.getSeriesSlotList(eval(args[0]),))

elif cmd == 'createCQ':
    if len(args) != 1:
        print('createCQ requires 1 args')
        sys.exit(1)
    pp.pprint(client.createCQ(eval(args[0]),))

elif cmd == 'dropCQ':
    if len(args) != 1:
        print('dropCQ requires 1 args')
        sys.exit(1)
    pp.pprint(client.dropCQ(eval(args[0]),))

elif cmd == 'showCQ':
    if len(args) != 0:
        print('showCQ requires 0 args')
        sys.exit(1)
    pp.pprint(client.showCQ())

elif cmd == 'createModel':
    if len(args) != 1:
        print('createModel requires 1 args')
        sys.exit(1)
    pp.pprint(client.createModel(eval(args[0]),))

elif cmd == 'dropModel':
    if len(args) != 1:
        print('dropModel requires 1 args')
        sys.exit(1)
    pp.pprint(client.dropModel(eval(args[0]),))

elif cmd == 'getModelInfo':
    if len(args) != 1:
        print('getModelInfo requires 1 args')
        sys.exit(1)
    pp.pprint(client.getModelInfo(eval(args[0]),))

elif cmd == 'updateModelInfo':
    if len(args) != 1:
        print('updateModelInfo requires 1 args')
        sys.exit(1)
    pp.pprint(client.updateModelInfo(eval(args[0]),))

elif cmd == 'setSpaceQuota':
    if len(args) != 1:
        print('setSpaceQuota requires 1 args')
        sys.exit(1)
    pp.pprint(client.setSpaceQuota(eval(args[0]),))

elif cmd == 'showSpaceQuota':
    if len(args) != 1:
        print('showSpaceQuota requires 1 args')
        sys.exit(1)
    pp.pprint(client.showSpaceQuota(eval(args[0]),))

elif cmd == 'getSpaceQuota':
    if len(args) != 0:
        print('getSpaceQuota requires 0 args')
        sys.exit(1)
    pp.pprint(client.getSpaceQuota())

elif cmd == 'setThrottleQuota':
    if len(args) != 1:
        print('setThrottleQuota requires 1 args')
        sys.exit(1)
    pp.pprint(client.setThrottleQuota(eval(args[0]),))

elif cmd == 'showThrottleQuota':
    if len(args) != 1:
        print('showThrottleQuota requires 1 args')
        sys.exit(1)
    pp.pprint(client.showThrottleQuota(eval(args[0]),))

elif cmd == 'getThrottleQuota':
    if len(args) != 0:
        print('getThrottleQuota requires 0 args')
        sys.exit(1)
    pp.pprint(client.getThrottleQuota())

elif cmd == 'pushHeartbeat':
    if len(args) != 2:
        print('pushHeartbeat requires 2 args')
        sys.exit(1)
    pp.pprint(client.pushHeartbeat(eval(args[0]), eval(args[1]),))

elif cmd == 'createTable':
    if len(args) != 1:
        print('createTable requires 1 args')
        sys.exit(1)
    pp.pprint(client.createTable(args[0],))

elif cmd == 'alterOrDropTable':
    if len(args) != 1:
        print('alterOrDropTable requires 1 args')
        sys.exit(1)
    pp.pprint(client.alterOrDropTable(eval(args[0]),))

elif cmd == 'showTables':
    if len(args) != 2:
        print('showTables requires 2 args')
        sys.exit(1)
    pp.pprint(client.showTables(args[0], eval(args[1]),))

elif cmd == 'showTables4InformationSchema':
    if len(args) != 0:
        print('showTables4InformationSchema requires 0 args')
        sys.exit(1)
    pp.pprint(client.showTables4InformationSchema())

elif cmd == 'describeTable':
    if len(args) != 3:
        print('describeTable requires 3 args')
        sys.exit(1)
    pp.pprint(client.describeTable(args[0], args[1], eval(args[2]),))

elif cmd == 'descTables4InformationSchema':
    if len(args) != 0:
        print('descTables4InformationSchema requires 0 args')
        sys.exit(1)
    pp.pprint(client.descTables4InformationSchema())

elif cmd == 'fetchTables':
    if len(args) != 1:
        print('fetchTables requires 1 args')
        sys.exit(1)
    pp.pprint(client.fetchTables(eval(args[0]),))

elif cmd == 'deleteDevice':
    if len(args) != 1:
        print('deleteDevice requires 1 args')
        sys.exit(1)
    pp.pprint(client.deleteDevice(eval(args[0]),))

elif cmd == 'createTableView':
    if len(args) != 1:
        print('createTableView requires 1 args')
        sys.exit(1)
    pp.pprint(client.createTableView(eval(args[0]),))

else:
    print('Unrecognized method %s' % cmd)
    sys.exit(1)

transport.close()
