-
Notifications
You must be signed in to change notification settings - Fork 860
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Aded DeleteDisk method to vmDiskClient.go
- Loading branch information
1 parent
72aed89
commit 1988e0c
Showing
2 changed files
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package vmDiskClient | ||
|
||
import ( | ||
"fmt" | ||
azure "github.com/MSOpenTech/azure-sdk-for-go" | ||
) | ||
|
||
const ( | ||
azureVMDiskURL = "services/disks/%s" | ||
) | ||
|
||
//Region public methods starts | ||
|
||
func DeleteDisk(diskName string) error { | ||
if len(diskName) == 0 { | ||
return fmt.Errorf(azure.ParamNotSpecifiedError, "diskName") | ||
} | ||
|
||
requestURL := fmt.Sprintf(azureVMDiskURL, diskName) | ||
requestId, err := azure.SendAzureDeleteRequest(requestURL) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
azure.WaitAsyncOperation(requestId) | ||
return nil | ||
} | ||
|
||
//Region public methods ends |