func (c *Client) UpdateParameter(instanceId, Etag string, args *UpdateParameterArgs) error {
	if isDDCId(instanceId) {
		return c.ddcClient.UpdateParameter(instanceId, args)
	}
	rdsArgs := &rds.UpdateParameterArgs{}
	err1 := ddc_util.SimpleCopyProperties(rdsArgs, args)
	if err1 != nil {
		return err1
	}
	err := c.rdsClient.UpdateParameter(instanceId, Etag, rdsArgs)
	return err
}
UpdateParameter - update Parameter

PARAMS:
- instanceId: the specific rds Instance's ID
- Etag: get latest etag by ListParameters
- Args: *UpdateParameterArgs
RETURNS:
- error: nil if success otherwise the specific error
package ddcrds
import (
	"encoding/json"
	"fmt"
	"strconv"
	"strings"
	"github.com/baidubce/bce-sdk-go/services/ddc/ddc_util"
	"github.com/baidubce/bce-sdk-go/services/rds"
)
func Int(value string) *int {
	if len(value) < 1 {
		return nil
	}
	intPtr, err := strconv.Atoi(value)
	if err != nil {
		panic("please pass valid int value ")
	}
	return &intPtr
}
func Json(v interface{}) string {
	jsonStr, err := json.Marshal(v)
	if err != nil {
		panic("convert to json faild")
	}
	return string(jsonStr)
}
func isDDC(productType string) bool {
	return productType == "ddc" || productType == "DDC"
}
func isDDCId(instanceId string) bool {
	if strings.HasPrefix(instanceId, "rds") {
		return false
	}
	return true
}
func getDDCAndRDSIds(instanceIds string) (string, string) {
	instanceIdArr := strings.Split(instanceIds, ",")
	ddcIds, rdsIds := "", ""
	if len(instanceIdArr) > 0 {
		for _, id := range instanceIdArr {
			if isDDCId(id) {
				ddcIds += id + ","
			} else {
				rdsIds += id + ","
			}
		}
	}
	if strings.HasSuffix(ddcIds, ",") {
		ddcIds = ddcIds[:len(ddcIds)-1]
	}
	if strings.HasSuffix(rdsIds, ",") {
		rdsIds = rdsIds[:len(rdsIds)-1]
	}
	return ddcIds, rdsIds
}
func (c *Client) CreateRds(args *CreateRdsArgs, productType string) (*CreateResult, error) {
	if args == nil {
		return nil, fmt.Errorf("unset args")
	}
	if strings.Contains(args.InstanceName, ".") {
		return nil, fmt.Errorf("invalid InstanceName:. not support")
	}
	var result *CreateResult
	var err error
	if isDDC(productType) {
		result, err = c.ddcClient.CreateRds(args)
	} else {
		rdsArgs := &rds.CreateRdsArgs{}
		err = ddc_util.SimpleCopyProperties(rdsArgs, args)
		if err != nil {
			return nil, err
		}
		var rdsRes *rds.CreateResult
		rdsRes, err = c.rdsClient.CreateRds(rdsArgs)
		if rdsRes != nil {
			result = &CreateResult{InstanceIds: rdsRes.InstanceIds}
		}
	}
	return result, err
}
func (c *Client) CreateReadReplica(args *CreateReadReplicaArgs) (*CreateResult, error) {
	if args == nil {
		return nil, fmt.Errorf("unset args")
	}
	if len(args.SourceInstanceId) < 1 {
		return nil, fmt.Errorf("unset SourceInstanceId")
	}
	if args.PurchaseCount < 1 {
		args.PurchaseCount = 1
	}
	var result *CreateResult
	var err error
	if isDDCId(args.SourceInstanceId) {
		result, err = c.ddcClient.CreateReadReplica(args)
	} else {
		rdsArgs := &rds.CreateReadReplicaArgs{}
		err = ddc_util.SimpleCopyProperties(rdsArgs, args)
		if err != nil {
			return nil, err
		}
		var rdsRes *rds.CreateResult
		rdsRes, err = c.rdsClient.CreateReadReplica(rdsArgs)
		if rdsRes != nil {
			result = &CreateResult{InstanceIds: rdsRes.InstanceIds}
		}
	}
	return result, err
}
func (c *Client) UpdateRoGroup(roGroupId string, args *UpdateRoGroupArgs, productType string) error {
	if isDDC(productType) {
		return c.ddcClient.UpdateRoGroup(roGroupId, args)
	}
	return RDSNotSupportError()
}
func (c *Client) UpdateRoGroupReplicaWeight(roGroupId string, args *UpdateRoGroupWeightArgs, productType string) error {
	if isDDC(productType) {
		return c.ddcClient.UpdateRoGroupReplicaWeight(roGroupId, args)
	}
	return RDSNotSupportError()
}
func (c *Client) ReBalanceRoGroup(roGroupId, productType string) error {
	if len(roGroupId) < 1 {
		return fmt.Errorf("unset roGroupId")
	}
	if isDDC(productType) {
		return c.ddcClient.ReBalanceRoGroup(roGroupId)
	}
	return RDSNotSupportError()
}
func (c *Client) CreateRdsProxy(args *CreateRdsProxyArgs) (*CreateResult, error) {
	if args == nil {
		return nil, fmt.Errorf("unset args")
	}
	if len(args.SourceInstanceId) < 1 {
		return nil, fmt.Errorf("unset SourceInstanceId")
	}
	if isDDCId(args.SourceInstanceId) {
		return nil, DDCNotSupportError()
	}
	rdsArgs := &rds.CreateRdsProxyArgs{}
	err := ddc_util.SimpleCopyProperties(rdsArgs, args)
	if err != nil {
		return nil, err
	}
	rdsRes, err := c.rdsClient.CreateRdsProxy(rdsArgs)
	if err != nil {
		return nil, err
	}
	result := &CreateResult{InstanceIds: rdsRes.InstanceIds}
	return result, err
}
func (c *Client) listRdsInstance(marker *ListRdsArgs) (*ListRdsResult, error) {
	rdsArgs := &rds.ListRdsArgs{}
	err := ddc_util.SimpleCopyProperties(rdsArgs, marker)
	if err != nil {
		return nil, err
	}
	var rdsRes *rds.ListRdsResult
	rdsRes, err = c.rdsClient.ListRds(rdsArgs)
	result := &ListRdsResult{}
	if rdsRes != nil {
		err = ddc_util.SimpleCopyProperties(result, rdsRes)
	}
	if result.Instances != nil &&
		len(result.Instances) > 0 {
		for i := range result.Instances {
			err = convertRdsInstance(&result.Instances[i])
		}
	}
	return result, err
}
func (c *Client) ListPage(args *ListPageArgs) (*ListPageResult, error) {
	result, err := c.ddcClient.ListPage(args)
	return result, err
}
func (c *Client) ListRds(marker *ListRdsArgs) (*ListRdsResult, error) {
	var result *ListRdsResult
	var err error
	if len(marker.Marker) < 1 || marker.Marker == "-1" || isDDCId(marker.Marker) {
		result, err = c.ddcClient.ListRds(marker)
		if err != nil {
			return nil, err
		}
		if len(result.Instances) < marker.MaxKeys {
			marker.MaxKeys = marker.MaxKeys - len(result.Instances)
			rdsResult, err := c.listRdsInstance(marker)
			if err != nil {
				return nil, err
			}
			if rdsResult != nil && len(rdsResult.Instances) > 0 {
				result.Instances = append(result.Instances, rdsResult.Instances...)
				result.Marker = rdsResult.Marker
				result.IsTruncated = rdsResult.IsTruncated
				result.NextMarker = rdsResult.NextMarker
			}
		} else if !result.IsTruncated {
			marker.MaxKeys = 1
			rdsResult, err := c.listRdsInstance(marker)
			if err != nil {
				return nil, err
			}
			if rdsResult != nil && len(rdsResult.Instances) > 0 {
				result.NextMarker = rdsResult.Instances[0].InstanceId
				result.IsTruncated = true
			}
		}
		return result, err
	}
	result, err = c.listRdsInstance(marker)
	return result, err
}
func (c *Client) GetDetail(instanceId string) (*Instance, error) {
	var result *Instance
	var err error
	if isDDCId(instanceId) {
		result, err = c.ddcClient.GetDetail(instanceId)
	} else {
		rdsRes, err1 := c.rdsClient.GetDetail(instanceId)
		if err1 != nil {
			return nil, err
		}
		if rdsRes != nil {
			result = &Instance{}
			err = ddc_util.SimpleCopyProperties(result, rdsRes)
			if err != nil {
				return nil, err
			}
			err = convertRdsInstance(result)
		}
	}
	return result, err
}
func convertRdsInstance(result *Instance) error {
	result.PubliclyAccessible = result.PublicAccessStatus == "Available"
	days := result.BackupPolicy.ExpireInDays
	var err error
	if len(days) > 0 {
		result.BackupPolicy.ExpireInDaysInt, err = strconv.Atoi(days)
	}
	return err
}
func (c *Client) DeleteRds(instanceIds string) error {
	var err error
	ddcIds, rdsIds := getDDCAndRDSIds(instanceIds)
	if len(ddcIds) > 0 {
		err = c.ddcClient.DeleteRds(ddcIds)
	}
	if err != nil {
		return err
	}
	if len(rdsIds) > 0 {
		err = c.rdsClient.DeleteRds(rdsIds)
	}
	return err
}
func (c *Client) ResizeRds(instanceId string, args *ResizeRdsArgs) (*OrderIdResponse, error) {
	if isDDCId(instanceId) {
		return c.ddcClient.ResizeRds(instanceId, args)
	}
	resReq := &rds.ResizeRdsArgs{}
	err := ddc_util.SimpleCopyProperties(resReq, args)
	if err != nil {
		return nil, err
	}
	err = c.rdsClient.ResizeRds(instanceId, resReq)
	return nil, err
}
func (c *Client) CreateAccount(instanceId string, args *CreateAccountArgs) error {
	var err error
	if isDDCId(instanceId) {
		err = c.ddcClient.CreateAccount(instanceId, args)
	} else {
		rdsArgs := &rds.CreateAccountArgs{}
		err = ddc_util.SimpleCopyProperties(rdsArgs, args)
		if err != nil {
			return err
		}
		err = c.rdsClient.CreateAccount(instanceId, rdsArgs)
	}
	return err
}
func (c *Client) ListAccount(instanceId string) (*ListAccountResult, error) {
	var result *ListAccountResult
	var err error
	if isDDCId(instanceId) {
		result, err = c.ddcClient.ListAccount(instanceId)
	} else {
		var rdsRes *rds.ListAccountResult
		rdsRes, err = c.rdsClient.ListAccount(instanceId)
		if rdsRes != nil {
			result = &ListAccountResult{}
			err = ddc_util.SimpleCopyProperties(result, rdsRes)
		}
	}
	return result, err
}
func (c *Client) GetAccount(instanceId, accountName string) (*Account, error) {
	var result *Account
	var err error
	if isDDCId(instanceId) {
		result, err = c.ddcClient.GetAccount(instanceId, accountName)
	} else {
		var rdsRes *rds.Account
		rdsRes, err = c.rdsClient.GetAccount(instanceId, accountName)
		if rdsRes != nil {
			result = &Account{}
			err = ddc_util.SimpleCopyProperties(result, rdsRes)
		}
	}
	return result, err
}
func (c *Client) DeleteAccount(instanceId, accountName string) error {
	var err error
	if isDDCId(instanceId) {
		err = c.ddcClient.DeleteAccount(instanceId, accountName)
	} else {
		err = c.rdsClient.DeleteAccount(instanceId, accountName)
	}
	return err
}
func (c *Client) RebootInstance(instanceId string) error {
	if isDDCId(instanceId) {
		args := &RebootArgs{IsRebootNow: true}
		return c.ddcClient.RebootInstanceWithArgs(instanceId, args)
	}
	err := c.rdsClient.RebootInstance(instanceId)
	return err
}
func (c *Client) RebootInstanceWithArgs(instanceId string, args *RebootArgs) error {
	if isDDCId(instanceId) {
		return c.ddcClient.RebootInstanceWithArgs(instanceId, args)
	}
	return RDSNotSupportError()
}
func (c *Client) UpdateInstanceName(instanceId string, args *UpdateInstanceNameArgs) error {
	var err error
	if isDDCId(instanceId) {
		err = c.ddcClient.UpdateInstanceName(instanceId, args)
	} else {
		rdsArgs := &rds.UpdateInstanceNameArgs{
			InstanceName: args.InstanceName,
		}
		err = c.rdsClient.UpdateInstanceName(instanceId, rdsArgs)
	}
	return err
}
func (c *Client) ModifySyncMode(instanceId string, args *ModifySyncModeArgs) error {
	if args == nil {
		return fmt.Errorf("unset args")
	}
	if isDDCId(instanceId) {
		return c.ddcClient.ModifySyncMode(instanceId, args)
	}
	rdsArgs := &rds.ModifySyncModeArgs{SyncMode: args.SyncMode}
	err := c.rdsClient.ModifySyncMode(instanceId, rdsArgs)
	return err
}
func (c *Client) ModifyEndpoint(instanceId string, args *ModifyEndpointArgs) error {
	if isDDCId(instanceId) {
		return DDCNotSupportError()
	}
	rdsArgs := &rds.ModifyEndpointArgs{Address: args.Address}
	err := c.rdsClient.ModifyEndpoint(instanceId, rdsArgs)
	return err
}
func (c *Client) ModifyPublicAccess(instanceId string, args *ModifyPublicAccessArgs) error {
	if isDDCId(instanceId) {
		return DDCNotSupportError()
	}
	rdsArgs := &rds.ModifyPublicAccessArgs{PublicAccess: args.PublicAccess}
	err := c.rdsClient.ModifyPublicAccess(instanceId, rdsArgs)
	return err
}
func (c *Client) GetBackupList(instanceId string, args *GetBackupListArgs) (*GetBackupListResult, error) {
	var result *GetBackupListResult
	var err error
	if isDDCId(instanceId) {
		result, err = c.ddcClient.GetBackupList(instanceId, args)
	} else {
		rdsArgs := &rds.GetBackupListArgs{}
		err = ddc_util.SimpleCopyProperties(rdsArgs, args)
		if err != nil {
			return nil, err
		}
		var rdsRes *rds.GetBackupListResult
		rdsRes, err = c.rdsClient.GetBackupList(instanceId, rdsArgs)
		if rdsRes != nil {
			result = &GetBackupListResult{}
			err = ddc_util.SimpleCopyProperties(result, rdsRes)
		}
	}
	return result, err
}
func (c *Client) GetZoneList(productType string) (*GetZoneListResult, error) {
	if isDDC(productType) {
		return c.ddcClient.GetZoneList()
	}
	rdsRes, err := c.rdsClient.GetZoneList()
	if err != nil {
		return nil, err
	}
	result := &GetZoneListResult{}
	err = ddc_util.SimpleCopyProperties(result, rdsRes)
	if err != nil {
		return nil, err
	}
	return result, err
}
func (c *Client) ListSubnets(args *ListSubnetsArgs, productType string) (*ListSubnetsResult, error) {
	if isDDC(productType) {
		return c.ddcClient.ListSubnets(args)
	}
	rdsArgs := &rds.ListSubnetsArgs{}
	err := ddc_util.SimpleCopyProperties(rdsArgs, args)
	if err != nil {
		return nil, err
	}
	rdsRes, err := c.rdsClient.ListSubnets(rdsArgs)
	if err != nil {
		return nil, err
	}
	result := &ListSubnetsResult{}
	err = ddc_util.SimpleCopyProperties(result, rdsRes)
	return result, err
}
func (c *Client) GetSecurityIps(instanceId string) (*GetSecurityIpsResult, error) {
	if isDDCId(instanceId) {
		return c.ddcClient.GetSecurityIps(instanceId)
	}
	rdsRes, err := c.rdsClient.GetSecurityIps(instanceId)
	if err != nil {
		return nil, err
	}
	result := &GetSecurityIpsResult{}
	err = ddc_util.SimpleCopyProperties(result, rdsRes)
	return result, err
}
func (c *Client) UpdateSecurityIps(instanceId, Etag string, args *UpdateSecurityIpsArgs) error {
	if isDDCId(instanceId) {
		return c.ddcClient.UpdateSecurityIps(instanceId, args)
	}
	rdsArgs := &rds.UpdateSecurityIpsArgs{SecurityIps: args.SecurityIps}
	err := c.rdsClient.UpdateSecurityIps(instanceId, Etag, rdsArgs)
	return err
}
func (c *Client) ListParameters(instanceId string) (*ListParametersResult, error) {
	if isDDCId(instanceId) {
		return c.ddcClient.ListParameters(instanceId)
	}
	rdsRes, err := c.rdsClient.ListParameters(instanceId)
	result := &ListParametersResult{}
	err1 := ddc_util.SimpleCopyProperties(result, rdsRes)
	if err1 != nil {
		return nil, err1
	}
	if result.Parameters != nil && len(result.Parameters) > 0 {
		for i, parameter := range result.Parameters {
			result.Parameters[i].IsDynamic = parameter.Dynamic == "true"
			result.Parameters[i].ISModifiable = parameter.Modifiable == "true"
		}
	}
	return result, err
}