Class: Milvus::Users

Inherits:
Base
  • Object
show all
Defined in:
lib/milvus/users.rb

Constant Summary collapse

PATH =
"users"

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Milvus::Base

Instance Method Details

#create(user_name:, password:) ⇒ Hash

Create a user

Parameters:

  • user_name (String)

    Username for the user

  • password (String)

    Password for the user

Returns:

  • (Hash)

    Server response



12
13
14
15
16
17
18
19
20
21
# File 'lib/milvus/users.rb', line 12

def create(user_name:, password:)
  response = client.connection.post("#{PATH}/create") do |req|
    req.body = {
      userName: user_name,
      password: password
    }
  end

  response.body
end

#describe(user_name:) ⇒ Hash

Describe a user

Parameters:

  • user_name (String)

    Username for the user

Returns:

  • (Hash)

    Server response



27
28
29
30
31
32
33
34
35
# File 'lib/milvus/users.rb', line 27

def describe(user_name:)
  response = client.connection.post("#{PATH}/describe") do |req|
    req.body = {
      userName: user_name
    }
  end

  response.body
end

#drop(user_name:) ⇒ Hash

Drops a user

Parameters:

  • user_name (String)

    Username for the user

Returns:

  • (Hash)

    Server response



52
53
54
55
56
57
58
59
60
# File 'lib/milvus/users.rb', line 52

def drop(user_name:)
  response = client.connection.post("#{PATH}/drop") do |req|
    req.body = {
      userName: user_name
    }
  end

  response.body
end

#grant_role(user_name:, role_name:) ⇒ Object



74
75
76
77
78
79
80
81
82
83
# File 'lib/milvus/users.rb', line 74

def grant_role(user_name:, role_name:)
  response = client.connection.post("#{PATH}/grant_role") do |req|
    req.body = {
      userName: user_name,
      roleName: role_name
    }
  end

  response.body
end

#listHash

List users

Returns:

  • (Hash)

    Server response



40
41
42
43
44
45
46
# File 'lib/milvus/users.rb', line 40

def list
  response = client.connection.post("#{PATH}/list") do |req|
    req.body = {}
  end

  response.body
end

#revoke_role(user_name:, role_name:) ⇒ Object



85
86
87
88
89
90
91
92
93
94
# File 'lib/milvus/users.rb', line 85

def revoke_role(user_name:, role_name:)
  response = client.connection.post("#{PATH}/revoke_role") do |req|
    req.body = {
      userName: user_name,
      roleName: role_name
    }
  end

  response.body
end

#update_password(user_name:, password:, new_password:) ⇒ Object



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/milvus/users.rb', line 62

def update_password(user_name:, password:, new_password:)
  response = client.connection.post("#{PATH}/update_password") do |req|
    req.body = {
      userName: user_name,
      password: password,
      newPassword: new_password
    }
  end

  response.body
end