本記事では、obshell-sdk-goを使用して指定されたテナントを削除する方法について説明します。
説明
package main
import (
"fmt"
"github.com/oceanbase/obshell-sdk-go/services"
)
func main() {
// クライアントインスタンスを作成します。ノードアドレスは'10.10.10.1'、ポートは2886です。
client, err := services.NewClientWithPassword("10.10.10.1", 2886, "****")
if err != nil {
fmt.Print(err)
return
}
req := client.V1().NewDropTenantRequest("t1")
if _, err = client.V1().DropTenantSyncWithRequest(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 set to '10.10.10.1' and the port number set to 2886.
client, err := services.NewClientWithPassword("10.10.10.1", 2886, "****")
if err != nil {
fmt.Print(err)
return
}
req := client.V1().NewDropTenantRequest("t1")
dag, err := client.V1().DropTenantWithRequest(req)
if err != nil {
fmt.Print(err)
return
}
// Wait for the task to complete successfully.
if dag != nil && dag.GenericDTO != nil {
if _, err = client.V1().WaitDagSucceed(dag.GenericID); err != nil {
fmt.Print(err)
return
}
}
}
関連ドキュメント
-
テナントを削除するAPIインターフェースの詳細については、テナントの削除を参照してください。
obshell-sdk-pythonを使用したAPIメソッドのリクエストについては、テナントの削除を参照してください。