21 lines
No EOL
668 B
C#
21 lines
No EOL
668 B
C#
using FrostFS.SDK.ModelsV2.Enums;
|
|
using FrostFS.SDK.ModelsV2.Netmap;
|
|
|
|
namespace FrostFS.SDK.ClientV2.Mappers.GRPC.Netmap;
|
|
|
|
public static class NodeInfoMapper
|
|
{
|
|
public static NodeInfo ToModel(this FrostFS.Netmap.LocalNodeInfoResponse.Types.Body nodeInfo)
|
|
{
|
|
var nodeStateName = Enum.GetName(typeof(NodeState), nodeInfo.NodeInfo.State);
|
|
if (nodeStateName is null)
|
|
{
|
|
throw new ArgumentException($"Unknown NodeState. Value: '{nodeInfo.NodeInfo.State}'.");
|
|
}
|
|
return new NodeInfo
|
|
{
|
|
State = Enum.Parse<NodeState>(nodeStateName),
|
|
Version = nodeInfo.Version.ToModel()
|
|
};
|
|
}
|
|
} |