@CliOption(key = { "regex" }, mandatory = false, specifiedDefaultValue = "true", unspecifiedDefaultValue = "false",
help = "Whether use regular expression for the datastore name(s) in vsphere") final boolean regex) {
//build DatastoreAdd object
try {
DatastoreAdd datastoreAdd = new DatastoreAdd();
datastoreAdd.setName(name);
if (CommandsUtils.inputsConvert(spec).isEmpty()) {
CommandsUtils.printCmdFailure(Constants.OUTPUT_OBJECT_DATASTORE,
name, Constants.OUTPUT_OP_ADD,
Constants.OUTPUT_OP_RESULT_FAIL, Constants.INPUT_SPEC_PARAM
+ Constants.MULTI_INPUTS_CHECK);
} else {
datastoreAdd.setSpec(CommandsUtils.inputsConvert(spec));
datastoreAdd.setType(DatastoreType.valueOf(type.toUpperCase()));
if (regex) {
datastoreAdd.setRegex(true);
}
restClient.add(datastoreAdd);
CommandsUtils.printCmdSuccess(Constants.OUTPUT_OBJECT_DATASTORE,
name, Constants.OUTPUT_OP_RESULT_ADD);