Skip to content

Commit

Permalink
Tidy up with gofmt
Browse files Browse the repository at this point in the history
  • Loading branch information
bfirsh committed Oct 8, 2014
1 parent 9907835 commit 1aa8e81
Show file tree
Hide file tree
Showing 14 changed files with 270 additions and 272 deletions.
22 changes: 11 additions & 11 deletions clients/imageClient/entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import (
)

type ImageList struct {
XMLName xml.Name `xml:"Images"`
Xmlns string `xml:"xmlns,attr"`
OSImages []OSImage `xml:"OSImage"`
XMLName xml.Name `xml:"Images"`
Xmlns string `xml:"xmlns,attr"`
OSImages []OSImage `xml:"OSImage"`
}

type OSImage struct {
Category string
Label string
LogicalSizeInGB string
Name string
OS string
Eula string
Description string
Location string
Category string
Label string
LogicalSizeInGB string
Name string
OS string
Eula string
Description string
Location string
}
10 changes: 5 additions & 5 deletions clients/imageClient/imageClient.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
package imageClient

import (
"fmt"
"encoding/xml"
"errors"
"fmt"
azure "github.com/MSOpenTech/azure-sdk-for-go"
)

const (
azureImageListURL = "services/images"
azureImageListURL = "services/images"
invalidLocationError = "Error: Can not find image %s in specified subscription, please specify another image name \n"
)

func GetImageList() (ImageList, error){
func GetImageList() (ImageList, error) {
imageList := ImageList{}

response, err := azure.SendAzureGetRequest(azureImageListURL)
Expand All @@ -24,11 +24,11 @@ func GetImageList() (ImageList, error){
return imageList, err
}

func ResolveImageName(imageName string) (error) {
func ResolveImageName(imageName string) error {
if len(imageName) == 0 {
return fmt.Errorf(azure.ParamNotSpecifiedError, "imageName")
}

imageList, err := GetImageList()
if err != nil {
return err
Expand Down
12 changes: 6 additions & 6 deletions clients/locationClient/entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import (
)

type LocationList struct {
XMLName xml.Name `xml:"Locations"`
Xmlns string `xml:"xmlns,attr"`
Locations []Location `xml:"Location"`
XMLName xml.Name `xml:"Locations"`
Xmlns string `xml:"xmlns,attr"`
Locations []Location `xml:"Location"`
}

type Location struct {
Name string
DisplayName string
AvailableServices []string `xml:"AvailableServices>AvailableService"`
Name string
DisplayName string
AvailableServices []string `xml:"AvailableServices>AvailableService"`
}
10 changes: 5 additions & 5 deletions clients/locationClient/locationClient.go
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package locationClient

import (
"fmt"
"strings"
"bytes"
"encoding/xml"
"errors"
"bytes"
"fmt"
azure "github.com/MSOpenTech/azure-sdk-for-go"
"strings"
)

const (
azureLocationListURL = "locations"
invalidLocationError = "Invalid location. Available locations: %s"
)

func ResolveLocation(location string) (error) {
func ResolveLocation(location string) error {
if len(location) == 0 {
return fmt.Errorf(azure.ParamNotSpecifiedError, "location")
}

locations, err := GetLocationList()
if err != nil {
return err
Expand Down
50 changes: 25 additions & 25 deletions clients/storageServiceClient/entities.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,45 @@ import (
)

type StorageServiceList struct {
XMLName xml.Name `xml:"StorageServices"`
Xmlns string `xml:"xmlns,attr"`
XMLName xml.Name `xml:"StorageServices"`
Xmlns string `xml:"xmlns,attr"`
StorageServices []StorageService `xml:"StorageService"`
}

type StorageService struct {
Url string
ServiceName string
StorageServiceProperties StorageServiceProperties
Url string
ServiceName string
StorageServiceProperties StorageServiceProperties
}

type StorageServiceProperties struct {
Description string
Location string
Label string
Status string
Endpoints []string `xml:"Endpoints>Endpoint"`
GeoReplicationEnabled string
GeoPrimaryRegion string
Description string
Location string
Label string
Status string
Endpoints []string `xml:"Endpoints>Endpoint"`
GeoReplicationEnabled string
GeoPrimaryRegion string
}

type StorageServiceDeployment struct {
XMLName xml.Name `xml:"CreateStorageServiceInput"`
Xmlns string `xml:"xmlns,attr"`
ServiceName string
Description string
Label string
AffinityGroup string `xml:",omitempty"`
Location string `xml:",omitempty"`
GeoReplicationEnabled bool
ExtendedProperties ExtendedPropertyList
SecondaryReadEnabled bool
XMLName xml.Name `xml:"CreateStorageServiceInput"`
Xmlns string `xml:"xmlns,attr"`
ServiceName string
Description string
Label string
AffinityGroup string `xml:",omitempty"`
Location string `xml:",omitempty"`
GeoReplicationEnabled bool
ExtendedProperties ExtendedPropertyList
SecondaryReadEnabled bool
}

type ExtendedPropertyList struct {
ExtendedProperty []ExtendedProperty
ExtendedProperty []ExtendedProperty
}

type ExtendedProperty struct {
Name string
Value string
Name string
Value string
}
26 changes: 13 additions & 13 deletions clients/storageServiceClient/storageServiceClient.go
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
package storageServiceClient

import (
"fmt"
"strings"
"errors"
"encoding/xml"
"encoding/base64"
"encoding/xml"
"errors"
"fmt"
azure "github.com/MSOpenTech/azure-sdk-for-go"
"strings"
)

const (
azureXmlns = "http://schemas.microsoft.com/windowsazure"
azureXmlns = "http://schemas.microsoft.com/windowsazure"
azureStorageServiceListURL = "services/storageservices"
azureStorageServiceURL = "services/storageservices/%s"
azureStorageServiceURL = "services/storageservices/%s"

blobEndpointNotFoundError = "Blob endpoint was not found in storage serice %s"
)

func GetStorageServiceList() (*StorageServiceList, error){
func GetStorageServiceList() (*StorageServiceList, error) {
storageServiceList := new(StorageServiceList)

response, err := azure.SendAzureGetRequest(azureStorageServiceListURL)
Expand All @@ -33,11 +33,11 @@ func GetStorageServiceList() (*StorageServiceList, error){
return storageServiceList, nil
}

func GetStorageServiceByName(serviceName string) (*StorageService, error){
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)
Expand All @@ -57,7 +57,7 @@ func GetStorageServiceByLocation(location string) (*StorageService, error) {
if len(location) == 0 {
return nil, fmt.Errorf(azure.ParamNotSpecifiedError, "location")
}

storageService := new(StorageService)
storageServiceList, err := GetStorageServiceList()
if err != nil {
Expand All @@ -75,14 +75,14 @@ func GetStorageServiceByLocation(location string) (*StorageService, error) {
return nil, nil
}

func CreateStorageService(name, location string) (*StorageService, error){
func CreateStorageService(name, location string) (*StorageService, error) {
if len(name) == 0 {
return nil, fmt.Errorf(azure.ParamNotSpecifiedError, "name")
}
if len(location) == 0 {
return nil, fmt.Errorf(azure.ParamNotSpecifiedError, "location")
}

storageDeploymentConfig := createStorageServiceDeploymentConf(name, location)
deploymentBytes, err := xml.Marshal(storageDeploymentConfig)
if err != nil {
Expand Down Expand Up @@ -115,7 +115,7 @@ func GetBlobEndpoint(storageService *StorageService) (string, error) {
return "", errors.New(fmt.Sprintf(blobEndpointNotFoundError, storageService.ServiceName))
}

func createStorageServiceDeploymentConf(name, location string) (StorageServiceDeployment){
func createStorageServiceDeploymentConf(name, location string) StorageServiceDeployment {
storageServiceDeployment := StorageServiceDeployment{}

storageServiceDeployment.ServiceName = name
Expand Down
Loading

0 comments on commit 1aa8e81

Please sign in to comment.