func (c *Client) FlushInstance(instanceId string, args *FlushInstanceArgs) error {
	cryptedPass, err := Aes128EncryptUseSecreteKey(c.Config.Credentials.SecretAccessKey, args.Password)
	if err != nil {
		return err
	}
	args.Password = cryptedPass
	return bce.NewRequestBuilder(c).
		WithMethod(http.PUT).
		WithURL(INSTANCE_URL_V1+"/"+instanceId+"/flush").
		WithQueryParamFilter("clientToken", args.ClientToken).
		WithBody(args).
		Do()
}
FlushInstance - flush a specified instance

PARAMS:
- cli: the client agent which can perform sending request
- instanceId: id of the instance
- args: the arguments to flush instance
RETURNS:
- error: nil if success otherwise the specific error
package scs
import (
	"encoding/json"
	"fmt"
	"strconv"
	"github.com/baidubce/bce-sdk-go/bce"
	"github.com/baidubce/bce-sdk-go/http"
)
const (
	KEY_MARKER                = "marker"
	KEY_MAX_KEYS              = "maxKeys"
	INSTANCE_URL_V1           = bce.URI_PREFIX + "v1" + "/instance"
	INSTANCE_URL_V2           = bce.URI_PREFIX + "v2" + "/instance"
	URI_PREFIX_V2             = bce.URI_PREFIX + "v2"
	URI_PREFIX_V1             = bce.URI_PREFIX + "v1"
	REQUEST_SECURITYGROUP_URL = "/security"
	REQUEST_RECYCLER_URL      = "/recycler"
)
func (c *Client) request(method, url string, result, body interface{}) (interface{}, error) {
	var err error
	if result != nil {
		err = bce.NewRequestBuilder(c).
			WithMethod(method).
			WithURL(url).
			WithHeader(http.CONTENT_TYPE, bce.DEFAULT_CONTENT_TYPE).
			WithBody(body).
			WithResult(result).
			Do()
	} else {
		err = bce.NewRequestBuilder(c).
			WithMethod(method).
			WithURL(url).
			WithHeader(http.CONTENT_TYPE, bce.DEFAULT_CONTENT_TYPE).
			WithBody(body).
			Do()
	}
	return result, err
}
func getInstanceUrlWithId(instanceId string) string {
	return INSTANCE_URL_V1 + "/" + instanceId
}
func getSecurityGroupWithVpcIdUrl(vpcId string) string {
	return URI_PREFIX_V2 + REQUEST_SECURITYGROUP_URL + "/vpc/" + vpcId
}
func getSecurityGroupWithInstanceIdUrl(instanceId string) string {
	return URI_PREFIX_V2 + REQUEST_SECURITYGROUP_URL + "/instance/" + instanceId
}
func getBindSecurityGroupWithUrl() string {
	return URI_PREFIX_V2 + REQUEST_SECURITYGROUP_URL + "/bind"
}
func getUnBindSecurityGroupWithUrl() string {
	return URI_PREFIX_V2 + REQUEST_SECURITYGROUP_URL + "/unbind"
}
func getReplaceSecurityGroupWithUrl() string {
	return URI_PREFIX_V2 + REQUEST_SECURITYGROUP_URL + "/update"
}
func getRecyclerUrl() string {
	return URI_PREFIX_V2 + REQUEST_RECYCLER_URL + "/list"
}
func getRecyclerRecoverUrl() string {
	return URI_PREFIX_V2 + REQUEST_RECYCLER_URL + "/recover"
}
func getRecyclerDeleteUrl() string {
	return URI_PREFIX_V2 + REQUEST_RECYCLER_URL + "/delete"
}
func getRenewUrl() string {
	return INSTANCE_URL_V2 + "/renew"
}
func getLogsUrlWithInstanceId(instanceId string) string {
	return INSTANCE_URL_V1 + "/" + instanceId + "/log"
}
func getLogsUrlWithLogId(instanceId, logId string) string {
	return INSTANCE_URL_V1 + "/" + instanceId + "/log/" + logId
}
func Json(v interface{}) string {
	jsonStr, err := json.Marshal(v)
	if err != nil {
		panic("convert to json faild")
	}
	return string(jsonStr)
}
func getMarkerParams(marker *Marker) map[string]string {
	if marker == nil {
		marker = &Marker{Marker: "-1"}
	}
	params := make(map[string]string, 2)
	params[KEY_MARKER] = marker.Marker
	if marker.MaxKeys > 0 {
		params[KEY_MAX_KEYS] = strconv.Itoa(marker.MaxKeys)
	}
	return params
}
func getQueryParams(val interface{}) (map[string]string, error) {
	var params map[string]string
	if val != nil {
		err := json.Unmarshal([]byte(Json(val)), &params)
		if err != nil {
			return nil, err
		}
	}
	return params, nil
}
func (c *Client) CreateInstance(args *CreateInstanceArgs) (*CreateInstanceResult, error) {
	if args == nil {
		return nil, fmt.Errorf("please set create scs argments")
	}
	result := &CreateInstanceResult{}
	err := bce.NewRequestBuilder(c).
		WithMethod(http.POST).
		WithURL(INSTANCE_URL_V2).
		WithQueryParamFilter("clientToken", args.ClientToken).
		WithBody(args).
		WithResult(result).
		Do()
	return result, err
}
func (c *Client) ListInstances(args *ListInstancesArgs) (*ListInstancesResult, error) {
	if args == nil {
		args = &ListInstancesArgs{}
	}
	if args.MaxKeys <= 0 || args.MaxKeys > 1000 {
		args.MaxKeys = 1000
	}
	result := &ListInstancesResult{}
	err := bce.NewRequestBuilder(c).
		WithMethod(http.GET).
		WithURL(INSTANCE_URL_V2).
		WithQueryParamFilter("marker", args.Marker).
		WithQueryParamFilter("maxKeys", strconv.Itoa(args.MaxKeys)).
		WithResult(result).
		Do()
	return result, err
}
func (c *Client) GetInstanceDetail(instanceId string) (*GetInstanceDetailResult, error) {
	result := &GetInstanceDetailResult{}
	err := bce.NewRequestBuilder(c).
		WithMethod(http.GET).
		WithURL(INSTANCE_URL_V2 + "/" + instanceId).
		WithResult(result).
		Do()
	return result, err
}
func (c *Client) ResizeInstance(instanceId string, args *ResizeInstanceArgs) error {
	return bce.NewRequestBuilder(c).
		WithMethod(http.PUT).
		WithURL(INSTANCE_URL_V1+"/"+instanceId+"/change").
		WithQueryParamFilter("clientToken", args.ClientToken).
		WithBody(args).
		Do()
}
func (c *Client) RestartInstance(instanceId string, args *RestartInstanceArgs) error {
	return bce.NewRequestBuilder(c).
		WithMethod(http.PUT).
		WithURL(getInstanceUrlWithId(instanceId)+"/restart").
		WithHeader(http.CONTENT_TYPE, bce.DEFAULT_CONTENT_TYPE).
		WithBody(args).
		Do()
}
func (c *Client) DeleteInstance(instanceId string, clientToken string) error {
	return bce.NewRequestBuilder(c).
		WithMethod(http.DELETE).
		WithURL(INSTANCE_URL_V1+"/"+instanceId).
		WithQueryParamFilter("clientToken", clientToken).
		Do()
}
func (c *Client) UpdateInstanceName(instanceId string, args *UpdateInstanceNameArgs) error {
	return bce.NewRequestBuilder(c).
		WithMethod(http.PUT).
		WithURL(INSTANCE_URL_V1+"/"+instanceId+"/rename").
		WithQueryParamFilter("clientToken", args.ClientToken).
		WithBody(args).
		Do()
}
func (c *Client) GetNodeTypeList() (*GetNodeTypeListResult, error) {
	getNodeTypeListResult := &GetNodeTypeListResult{}
	err := bce.NewRequestBuilder(c).
		WithMethod(http.GET).
		WithURL("/v2/nodetypes").
		WithResult(getNodeTypeListResult).
		Do()
	return getNodeTypeListResult, err
}
func (c *Client) ListSubnets(args *ListSubnetsArgs) (*ListSubnetsResult, error) {
	if args == nil {
		args = &ListSubnetsArgs{}
	}
	result := &ListSubnetsResult{}
	err := bce.NewRequestBuilder(c).
		WithMethod(http.GET).
		WithURL("/v1/subnet").
		WithQueryParamFilter("vpcId", args.VpcID).
		WithQueryParamFilter("zoneName", args.ZoneName).
		WithResult(result).
		Do()
	return result, err
}
func (c *Client) UpdateInstanceDomainName(instanceId string, args *UpdateInstanceDomainNameArgs) error {
	if args == nil || args.Domain == "" {
		return fmt.Errorf("unset Domain")
	}
	return bce.NewRequestBuilder(c).
		WithMethod(http.PUT).
		WithURL(INSTANCE_URL_V1+"/"+instanceId+"/renameDomain").
		WithQueryParamFilter("clientToken", args.ClientToken).
		WithBody(args).
		Do()
}
func (c *Client) GetZoneList() (*GetZoneListResult, error) {
	result := &GetZoneListResult{}
	err := bce.NewRequestBuilder(c).
		WithMethod(http.GET).
		WithURL("/v1/zone").
		WithResult(result).
		Do()
	return result, err
}