func GetRole(cloudserviceName, deploymentName, roleName string) (*Role, error) { if len(cloudserviceName) == 0 { return nil, fmt.Errorf(azure.ParamNotSpecifiedError, "cloudserviceName") } if len(deploymentName) == 0 { return nil, fmt.Errorf(azure.ParamNotSpecifiedError, "deploymentName") } if len(roleName) == 0 { return nil, fmt.Errorf(azure.ParamNotSpecifiedError, "roleName") } role := new(Role) requestURL := fmt.Sprintf(azureRoleURL, cloudserviceName, deploymentName, roleName) response, azureErr := azure.SendAzureGetRequest(requestURL) if azureErr != nil { return nil, azureErr } err := xml.Unmarshal(response, role) if err != nil { return nil, err } return role, nil }
func GetLocationList() (LocationList, error) { locationList := LocationList{} response, err := azure.SendAzureGetRequest(azureLocationListURL) if err != nil { return locationList, err } err = xml.Unmarshal(response, &locationList) if err != nil { return locationList, err } return locationList, nil }
func GetStorageServiceList() (*StorageServiceList, error) { storageServiceList := new(StorageServiceList) response, err := azure.SendAzureGetRequest(azureStorageServiceListURL) if err != nil { return nil, err } err = xml.Unmarshal(response, storageServiceList) if err != nil { return storageServiceList, err } return storageServiceList, nil }
func GetImageList() (ImageList, error) { imageList := ImageList{} response, err := azure.SendAzureGetRequest(azureImageListURL) if err != nil { return imageList, err } err = xml.Unmarshal(response, &imageList) if err != nil { return imageList, err } return imageList, err }
func GetRoleSizeList() (RoleSizeList, error) { roleSizeList := RoleSizeList{} response, err := azure.SendAzureGetRequest(azureRoleSizeListURL) if err != nil { return roleSizeList, err } err = xml.Unmarshal(response, &roleSizeList) if err != nil { return roleSizeList, err } return roleSizeList, err }
func GetStorageServiceByName(serviceName string) (*StorageService, error) { if len(serviceName) == 0 { return nil, fmt.Errorf(azure.ParamNotSpecifiedError, "serviceName") } storageService := new(StorageService) requestURL := fmt.Sprintf(azureStorageServiceURL, serviceName) response, err := azure.SendAzureGetRequest(requestURL) if err != nil { return nil, err } err = xml.Unmarshal(response, storageService) if err != nil { return nil, err } return storageService, nil }
func GetVMDeployment(cloudserviceName, deploymentName string) (*VMDeployment, error) { if len(cloudserviceName) == 0 { return nil, fmt.Errorf(azure.ParamNotSpecifiedError, "cloudserviceName") } if len(deploymentName) == 0 { return nil, fmt.Errorf(azure.ParamNotSpecifiedError, "deploymentName") } deployment := new(VMDeployment) requestURL := fmt.Sprintf(azureDeploymentURL, cloudserviceName, deploymentName) response, azureErr := azure.SendAzureGetRequest(requestURL) if azureErr != nil { return nil, azureErr } err := xml.Unmarshal(response, deployment) if err != nil { return nil, err } return deployment, nil }
func CheckHostedServiceNameAvailability(dnsName string) (bool, string, error) { if len(dnsName) == 0 { return false, "", fmt.Errorf(azure.ParamNotSpecifiedError, "dnsName") } err := verifyDNSname(dnsName) if err != nil { return false, "", err } requestURL := fmt.Sprintf(azureHostedServiceAvailabilityURL, dnsName) response, err := azure.SendAzureGetRequest(requestURL) if err != nil { return false, "", err } availabilityResponse := new(AvailabilityResponse) err = xml.Unmarshal(response, availabilityResponse) if err != nil { return false, "", err } return availabilityResponse.Result, availabilityResponse.Reason, nil }