This topic describes how to query the overview of all tenants in a cluster 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.
The node corresponding to the client must be in an initialized cluster.
Sample code
package main
import (
"fmt"
"github.com/oceanbase/obshell-sdk-go/services"
)
func main() {
// Create a client instance with the node address '10.10.10.1' and port 2886.
client, err := services.NewClientWithPassword("10.10.10.1", 2886, "****")
if err != nil {
fmt.Print(err)
return
}
tenants, err := client.V1().GetAllTenantOverview()
if err != nil {
fmt.Print(err)
return
}
fmt.Printf("tenants' overview: %v\n", tenants)
}
References
For more information about the API for querying the overview of all tenants, see Query the overview of all tenants.
For more information about how to request API methods by using obshell-sdk-python, see Query the overview of all tenants.