This topic describes how to use obshell-sdk-go to purge tenants from the recycle bin. The corresponding resource pools will also be released.
Note
We recommend that you first go to obshell-sdk-go Quick Start 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
}
req := client.V1().NewPurgeRecyclebinTenantRequest("t1")
if _, err := client.V1().PurgeRecyclebinTenantSyncWithRequest(req); err != nil {
fmt.Print(err)
return
}
}
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
}
req := client.V1().NewPurgeRecyclebinTenantRequest("t1")
dag, err := client.V1().PurgeRecyclebinTenantWithRequest(req)
if err != nil {
fmt.Print(err)
return
}
if dag != nil && dag.GenericDTO != nil {
// Wait for the task to succeed.
if _, err = client.V1().WaitDagSucceed(dag.GenericID); err != nil {
fmt.Print(err)
return
}
}
}
References
For more information about the API for purging tenants from the recycle bin, see Purge tenants from the recycle bin.
For more information about how to request API methods by using obshell-sdk-python, see Purge tenants from the recycle bin.