This topic describes how to query information about a specified tenant by using obshell-sdk-go.
Note
We recommend that you first read Get started with obshell-sdk-go to learn how to use obshell-sdk-go.
Considerations
Make sure that obshell is running.
Make sure that the tenant exists.
The node corresponding to the client in the request must be initialized.
Sample code
package main
import (
"fmt"
"github.com/oceanbase/obshell-sdk-go/services"
)
func main() {
// Create a client instance, where the node address is '10.10.10.1' and the port is 2886.
client, err := services.NewClientWithPassword("10.10.10.1", 2886, "****")
if err != nil {
fmt.Print(err)
return
}
tenant, err := client.V1().GetTenantInfo("t1")
if err != nil {
fmt.Print(err)
return
}
fmt.Printf("tenant info: %v\n", tenant)
}
References
For more information about the API for querying tenant information, see Query tenant information.
For more information about how to request API methods by using obshell-sdk-python, see Query tenant information.