This commit is contained in:
Uwe Seimet 2021-12-18 14:34:48 +01:00
parent 6a84edd0fb
commit c3ea3c8b37
3 changed files with 5 additions and 5 deletions

View File

@ -174,7 +174,7 @@ message PbOperationParameter {
// The list of parameters supported by an operation
message PbOperationMetaData {
// The operation name at the time the server-side protobuf code was generated.
string name = 1;
string server_side_name = 1;
// Optional short localized description, key is the lower case locale (e.g. en, de).
// Falling back to "en" is recommended if a description for a particular language is missing.
map<string, string> description = 2;

View File

@ -467,7 +467,7 @@ PbOperationInfo *RascsiResponse::GetOperationInfo(PbResult& result)
void RascsiResponse::CreateOperation(PbOperationInfo *operation_info, PbOperationMetaData *meta_data,
const PbOperation& operation, const string& description)
{
meta_data->set_name(PbOperation_Name(operation));
meta_data->set_server_side_name(PbOperation_Name(operation));
(*meta_data->mutable_description())["en"] = description;
int ordinal = PbOperation_descriptor()->FindValueByName(PbOperation_Name(operation))->index();
(*operation_info->mutable_operations())[ordinal] = *meta_data;

View File

@ -279,7 +279,7 @@ void RasctlDisplay::DisplayOperationInfo(const PbOperationInfo& operation_info)
const map<int, PbOperationMetaData> operations = { operation_info.operations().begin(), operation_info.operations().end() };
// Copies result into a map sorted by operation name
PbOperationMetaData *unknown_operation = new PbOperationMetaData();
const PbOperationMetaData *unknown_operation = new PbOperationMetaData();
map<string, PbOperationMetaData> sorted_operations;
for (const auto& operation : operations) {
if (PbOperation_IsValid(static_cast<PbOperation>(operation.first))) {
@ -287,13 +287,13 @@ void RasctlDisplay::DisplayOperationInfo(const PbOperationInfo& operation_info)
}
else {
// If the server-side operation is unknown for the client use the server-provided operation name
sorted_operations[operation.second.name()] = *unknown_operation;
sorted_operations[operation.second.server_side_name()] = *unknown_operation;
}
}
cout << "Remote operations supported by rascsi and their parameters:" << endl;
for (const auto& operation : sorted_operations) {
if (!operation.second.name().empty()) {
if (!operation.second.server_side_name().empty()) {
cout << " " << operation.first;
if (!operation.second.description().empty()) {
cout << " (" << operation.second.description().at("en") << ")";