in cosmos-db-migration-utility/src/configure/commandline_parser.py [0:0]
def __validate_arguments(self):
parser = self.__get_parser()
config = vars(parser.parse_args())
logger.info("Command line arguments given: " + json.dumps(config))
# Verify necessary components are supplied in command line arguments
command = []
if config["connection_string"]:
command.append("connection_string")
if config["status"]:
command.append("status")
if config["watch_status"]:
command.append("watch_status")
if not config["event_writer"] is None:
command.append("event_writer")
if len(command) == 0:
raise ApplicationException("Missing input argument for command. Specify --connection-string or --event-writer.")
if len(command) > 1:
raise ApplicationException("Please specify only one of the commands: --connection-string, --event_writer, --status or --watch-status arguments.")
config["command"] = command[0]
logger.info("Validated Command line arguments are: " + json.dumps(config))
if config["command"] == "event_writer":
if config["event_writer"] != "start" and config["event_writer"] != "stop":
raise ApplicationException("Given value for event-writer is not valid: {}. Valid values are stop or start".format(config["event_writer"]))
elif config["command"] == "connection_string":
if config["connection_string"] == "" or config["connection_string"] == None:
raise ApplicationException("Given value for connection-string is not valid: [{}].".format(config["connection_string"]))
return config