This topic describes how to update the backup configuration for a tenant by using obshell-sdk-go.
The difference between updating the backup configuration for a tenant and setting the backup configuration for a tenant is that you do not need to set the data_base_uri and archive_base_uri parameters.
Notice
If you want to set the binding and piece_switch_interval parameters, you must set the archive_base_uri parameter, because the three parameters are bound and cannot be set individually.
Note
It is recommended that you first go to 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 (
"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 set to 2886.
client, err := services.NewClientWithPassword("10.10.10.1", 2886, "****")
if err != nil {
panic(err)
}
request := client.V1().NewTenantBackupConfigPatchRequest("tenant2")
request.SetDeletePolicy("", "3d")
_, err = client.V1().TenantBackupConfigSyncWithRequest(request)
if err != nil {
panic(err)
}
}
References
For more information about the API for updating the backup configuration for a tenant, see Update the backup configuration for a tenant.
For more information about how to request API methods by using obshell-sdk-python, see Update the backup configuration for a tenant.