mirror of
https://github.com/akuker/RASCSI.git
synced 2024-06-07 13:53:33 +00:00
Display permitted values
This commit is contained in:
parent
acc7d3cba5
commit
5d894d2e4f
|
@ -394,7 +394,10 @@ PbOperationInfo *RascsiResponse::GetOperationInfo(PbResult& result)
|
||||||
AddOperationParameter(*parameters, "ids", "Comma-separated device ID list");
|
AddOperationParameter(*parameters, "ids", "Comma-separated device ID list");
|
||||||
|
|
||||||
parameters = AddOperation(*operation_info, SHUT_DOWN, "Shut down or reboot");
|
parameters = AddOperation(*operation_info, SHUT_DOWN, "Shut down or reboot");
|
||||||
AddOperationParameter(*parameters, "mode", "Shutdown mode");
|
PbOperationParameter *parameter = AddOperationParameter(*parameters, "mode", "Shutdown mode");
|
||||||
|
parameter->add_values("rascsi");
|
||||||
|
parameter->add_values("system");
|
||||||
|
parameter->add_values("reboot");
|
||||||
|
|
||||||
parameters = AddOperation(*operation_info, CREATE_IMAGE, "Create an image file");
|
parameters = AddOperation(*operation_info, CREATE_IMAGE, "Create an image file");
|
||||||
AddOperationParameter(*parameters, "file", "Image file name");
|
AddOperationParameter(*parameters, "file", "Image file name");
|
||||||
|
@ -439,12 +442,14 @@ PbOperationParameters *RascsiResponse::AddOperation(PbOperationInfo& operation_i
|
||||||
return parameters;
|
return parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RascsiResponse::AddOperationParameter(PbOperationParameters& parameters, const string& name, const string& description,
|
PbOperationParameter *RascsiResponse::AddOperationParameter(PbOperationParameters& parameters, const string& name,
|
||||||
const string& type, bool is_mandatory)
|
const string& description, const string& type, bool is_mandatory)
|
||||||
{
|
{
|
||||||
PbOperationParameter *parameter = parameters.add_parameters();
|
PbOperationParameter *parameter = parameters.add_parameters();
|
||||||
parameter->set_name(name);
|
parameter->set_name(name);
|
||||||
(*parameter->mutable_description())["en"] = description;
|
(*parameter->mutable_description())["en"] = description;
|
||||||
parameter->set_type(type);
|
parameter->set_type(type);
|
||||||
parameter->set_is_mandatory(is_mandatory);
|
parameter->set_is_mandatory(is_mandatory);
|
||||||
|
|
||||||
|
return parameter;
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,5 +54,5 @@ private:
|
||||||
void GetDeviceTypeProperties(PbDeviceTypesInfo&, PbDeviceType);
|
void GetDeviceTypeProperties(PbDeviceTypesInfo&, PbDeviceType);
|
||||||
void GetAvailableImages(PbResult& result, PbServerInfo&);
|
void GetAvailableImages(PbResult& result, PbServerInfo&);
|
||||||
PbOperationParameters *AddOperation(PbOperationInfo&, const PbOperation&, const string&);
|
PbOperationParameters *AddOperation(PbOperationInfo&, const PbOperation&, const string&);
|
||||||
void AddOperationParameter(PbOperationParameters&, const string&, const string&, const string& = "string", bool = true);
|
PbOperationParameter *AddOperationParameter(PbOperationParameters&, const string&, const string&, const string& = "string", bool = true);
|
||||||
};
|
};
|
||||||
|
|
|
@ -295,6 +295,19 @@ void RasctlDisplay::DisplayOperationInfo(const PbOperationInfo& operation_info)
|
||||||
cout << " (" << parameter.description().at("en") << ")";
|
cout << " (" << parameter.description().at("en") << ")";
|
||||||
}
|
}
|
||||||
cout << endl;
|
cout << endl;
|
||||||
|
|
||||||
|
if (parameter.values_size()) {
|
||||||
|
cout << " Permitted values: ";
|
||||||
|
bool isFirst = true;
|
||||||
|
for (const auto& value : parameter.values()) {
|
||||||
|
if (!isFirst) {
|
||||||
|
cout << ", ";
|
||||||
|
}
|
||||||
|
isFirst = false;
|
||||||
|
cout << value;
|
||||||
|
}
|
||||||
|
cout << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user