Don't return strings, always structs
This commit is contained in:
parent
9dd666c7e6
commit
305ccd54f7
|
@ -169,24 +169,24 @@ func (dr *databasePluginRPCClient) Close() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dr *databasePluginRPCClient) GenerateUsername(displayName string) (string, error) {
|
func (dr *databasePluginRPCClient) GenerateUsername(displayName string) (string, error) {
|
||||||
var username string
|
resp := &GenerateUsernameResponse{}
|
||||||
err := dr.client.Call("Plugin.GenerateUsername", displayName, &username)
|
err := dr.client.Call("Plugin.GenerateUsername", displayName, resp)
|
||||||
|
|
||||||
return username, err
|
return resp.Username, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dr *databasePluginRPCClient) GeneratePassword() (string, error) {
|
func (dr *databasePluginRPCClient) GeneratePassword() (string, error) {
|
||||||
var password string
|
resp := &GeneratePasswordResponse{}
|
||||||
err := dr.client.Call("Plugin.GeneratePassword", struct{}{}, &password)
|
err := dr.client.Call("Plugin.GeneratePassword", struct{}{}, resp)
|
||||||
|
|
||||||
return password, err
|
return resp.Password, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (dr *databasePluginRPCClient) GenerateExpiration(duration time.Duration) (string, error) {
|
func (dr *databasePluginRPCClient) GenerateExpiration(duration time.Duration) (string, error) {
|
||||||
var expiration string
|
resp := &GenerateExpirationResponse{}
|
||||||
err := dr.client.Call("Plugin.GenerateExpiration", duration, &expiration)
|
err := dr.client.Call("Plugin.GenerateExpiration", duration, resp)
|
||||||
|
|
||||||
return expiration, err
|
return resp.Expiration, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- RPC server domain ----
|
// ---- RPC server domain ----
|
||||||
|
@ -230,28 +230,28 @@ func (ds *databasePluginRPCServer) Close(_ struct{}, _ *struct{}) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ds *databasePluginRPCServer) GenerateUsername(args string, resp *string) error {
|
func (ds *databasePluginRPCServer) GenerateUsername(args string, resp *GenerateUsernameResponse) error {
|
||||||
var err error
|
var err error
|
||||||
*resp, err = ds.impl.GenerateUsername(args)
|
resp.Username, err = ds.impl.GenerateUsername(args)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ds *databasePluginRPCServer) GeneratePassword(_ struct{}, resp *string) error {
|
func (ds *databasePluginRPCServer) GeneratePassword(_ struct{}, resp *GeneratePasswordResponse) error {
|
||||||
var err error
|
var err error
|
||||||
*resp, err = ds.impl.GeneratePassword()
|
resp.Password, err = ds.impl.GeneratePassword()
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ds *databasePluginRPCServer) GenerateExpiration(args time.Duration, resp *string) error {
|
func (ds *databasePluginRPCServer) GenerateExpiration(args time.Duration, resp *GenerateExpirationResponse) error {
|
||||||
var err error
|
var err error
|
||||||
*resp, err = ds.impl.GenerateExpiration(args)
|
resp.Expiration, err = ds.impl.GenerateExpiration(args)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---- Request Args domain ----
|
// ---- Request Args Domain ----
|
||||||
|
|
||||||
type CreateUserRequest struct {
|
type CreateUserRequest struct {
|
||||||
Statements Statements
|
Statements Statements
|
||||||
|
@ -270,3 +270,15 @@ type RevokeUserRequest struct {
|
||||||
Statements Statements
|
Statements Statements
|
||||||
Username string
|
Username string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ---- Response Args Domain ----
|
||||||
|
|
||||||
|
type GenerateUsernameResponse struct {
|
||||||
|
Username string
|
||||||
|
}
|
||||||
|
type GenerateExpirationResponse struct {
|
||||||
|
Expiration string
|
||||||
|
}
|
||||||
|
type GeneratePasswordResponse struct {
|
||||||
|
Password string
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue