func (c *AzureClient) Rename(oldpath, newpath string) error {
	exist, err := c.Exists(oldpath)
	if err != nil {
		return err
	}
	if !exist {
		return fmt.Errorf("azureClient : oldpath does not exist")
	}
	srcContainerName, srcBlobName, err := convertToAzurePath(oldpath)
	if err != nil {
		return err
	}
	dstContainerName, dstBlobName, err := convertToAzurePath(newpath)
	if err != nil {
		return err
	}
	if srcBlobName == "" && dstBlobName == "" {
		resp, err := c.blobClient.ListBlobs(srcContainerName, storage.ListBlobsParameters{Marker: ""})
		if err != nil {
			return err
		}
		_, err = c.blobClient.CreateContainerIfNotExists(dstContainerName, storage.ContainerAccessTypeBlob)
		if err != nil {
			return err
		}

		for _, blob := range resp.Blobs {
			err = c.moveBlob(dstContainerName, blob.Name, srcContainerName, blob.Name, true)
			if err != nil {
				return err
			}
		}
		err = c.blobClient.DeleteContainer(srcContainerName)
		if err != nil {
			return err
		}
	} else if srcBlobName != "" && dstBlobName != "" {
		c.moveBlob(dstContainerName, dstBlobName, srcContainerName, srcBlobName, false)
	} else {
		return fmt.Errorf("Rename path does not match")
	}

	return nil
}
// AzureClient -> Rename function
// support rename contianer and blob
> Rename function
support rename contianer and blob
// AzureClient - > Rename function // support rename contianer and blob
func (c *AzureClient) Rename(oldpath, newpath string) error {
	exist, err := c.Exists(oldpath)
	if err != nil {
		return err
	}
	if !exist {
		return fmt.Errorf("azureClient : oldpath does not exist")
	}
	srcContainerName, srcBlobName, err := convertToAzurePath(oldpath)
	if err != nil {
		return err
	}
	dstContainerName, dstBlobName, err := convertToAzurePath(newpath)
	if err != nil {
		return err
	}
	if srcBlobName == "" && dstBlobName == "" {
		resp, err := c.blobClient.ListBlobs(srcContainerName, storage.ListBlobsParameters{Marker: ""})
		if err != nil {
			return err
		}
		_, err = c.blobClient.CreateContainerIfNotExists(dstContainerName, storage.ContainerAccessTypeBlob)
		if err != nil {
			return err
		}
		for _, blob := range resp.Blobs {
			err = c.moveBlob(dstContainerName, blob.Name, srcContainerName, blob.Name, true)
			if err != nil {
				return err
			}
		}
		err = c.blobClient.DeleteContainer(srcContainerName)
		if err != nil {
			return err
		}
	} else if srcBlobName != "" && dstBlobName != "" {
		c.moveBlob(dstContainerName, dstBlobName, srcContainerName, srcBlobName, false)
	} else {
		return fmt.Errorf("Rename path does not match")
	}
	return nil
}
func ( c * AzureClient ) Rename ( oldpath , newpath string ) error { exist , err := c . Exists ( oldpath ) if err != nil { return err } if ! exist { return fmt . Errorf ( " " ) } srcContainerName , srcBlobName , err := convertToAzurePath ( oldpath ) if err != nil { return err } dstContainerName , dstBlobName , err := convertToAzurePath ( newpath ) if err != nil { return err } if srcBlobName == " " && dstBlobName == " " { resp , err := c . blobClient . ListBlobs ( srcContainerName , storage . ListBlobsParameters { Marker : " " } ) if err != nil { return err } _ , err = c . blobClient . CreateContainerIfNotExists ( dstContainerName , storage . ContainerAccessTypeBlob ) if err != nil { return err } for _ , blob := range resp . Blobs { err = c . moveBlob ( dstContainerName , blob . Name , srcContainerName , blob . Name , true ) if err != nil { return err } } err = c . blobClient . DeleteContainer ( srcContainerName ) if err != nil { return err } } else if srcBlobName != " " && dstBlobName != " " { c . moveBlob ( dstContainerName , dstBlobName , srcContainerName , srcBlobName , false ) } else { return fmt . Errorf ( " " ) } return nil }
> Rename function
support rename contianer and blob
> Rename function support rename contianer and blob