メインコンテンツまでスキップ

UserDesc

このクラスは、Milvus ユーザーのメタデータを表します。DescribeUserResponse に対して Desc() を呼び出すと返されます。

c++
UserDesc();
UserDesc(const std::string& name, std::vector<std::string>&& roles);

メソッド:

  • const std::string& Name() const

    ユーザー名です。

  • const std::vector<std::string>& Roles() const

    ユーザーに割り当てられているロール名のリストです。

c++
#include <milvus/MilvusClientV2.h>
using namespace milvus;

auto client = MilvusClientV2::Create();
client->Connect(ConnectParam("YOUR_CLUSTER_ENDPOINT").WithToken("YOUR_CLUSTER_TOKEN"));

DescribeUserResponse response;
auto status = client->DescribeUser(
DescribeUserRequest().WithUsername("alice"),
response);
if (!status.IsOk()) {
std::cout << status.Message() << std::endl;
}

const UserDesc& desc = response.Desc();
std::cout << "User: " << desc.Name() << "\n";
for (const auto& role : desc.Roles()) {
std::cout << " role: " << role << "\n";
}
Ctrl I