...

Source file src/github.com/Azure/azure-sdk-for-go/services/classic/management/location/client.go

Documentation: github.com/Azure/azure-sdk-for-go/services/classic/management/location

     1  // +build go1.7
     2  
     3  // Package location provides a client for Locations.
     4  package location
     5  
     6  // Copyright (c) Microsoft Corporation. All rights reserved.
     7  // Licensed under the MIT License. See License.txt in the project root for license information.
     8  
     9  import (
    10  	"encoding/xml"
    11  
    12  	"github.com/Azure/azure-sdk-for-go/services/classic/management"
    13  )
    14  
    15  const (
    16  	azureLocationListURL = "locations"
    17  	errParamNotSpecified = "Parameter %s is not specified."
    18  )
    19  
    20  //NewClient is used to instantiate a new LocationClient from an Azure client
    21  func NewClient(client management.Client) LocationClient {
    22  	return LocationClient{client: client}
    23  }
    24  
    25  func (c LocationClient) ListLocations() (ListLocationsResponse, error) {
    26  	var l ListLocationsResponse
    27  
    28  	response, err := c.client.SendAzureGetRequest(azureLocationListURL)
    29  	if err != nil {
    30  		return l, err
    31  	}
    32  
    33  	err = xml.Unmarshal(response, &l)
    34  	return l, err
    35  }
    36  

View as plain text