3
// Copyright (c) Microsoft and contributors. All rights reserved.
5
// Licensed under the Apache License, Version 2.0 (the "License");
6
// you may not use this file except in compliance with the License.
7
// You may obtain a copy of the License at
8
// http://www.apache.org/licenses/LICENSE-2.0
10
// Unless required by applicable law or agreed to in writing, software
11
// distributed under the License is distributed on an "AS IS" BASIS,
12
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
// See the License for the specific language governing permissions and
15
// limitations under the License.
17
// Code generated by Microsoft (R) AutoRest Code Generator 0.12.0.0
18
// Changes may cause incorrect behavior and will be lost if the code is
22
"github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/github.com/Azure/go-autorest/autorest"
27
// VirtualMachineSizesClient is the the Compute Management Client.
28
type VirtualMachineSizesClient struct {
32
// NewVirtualMachineSizesClient creates an instance of the
33
// VirtualMachineSizesClient client.
34
func NewVirtualMachineSizesClient(subscriptionID string) VirtualMachineSizesClient {
35
return NewVirtualMachineSizesClientWithBaseURI(DefaultBaseURI, subscriptionID)
38
// NewVirtualMachineSizesClientWithBaseURI creates an instance of the
39
// VirtualMachineSizesClient client.
40
func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSizesClient {
41
return VirtualMachineSizesClient{NewWithBaseURI(baseURI, subscriptionID)}
44
// List lists virtual-machine-sizes available in a location for a subscription.
46
// location is the location upon which virtual-machine-sizes is queried.
47
func (client VirtualMachineSizesClient) List(location string) (result VirtualMachineSizeListResult, ae error) {
48
req, err := client.ListPreparer(location)
50
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineSizesClient", "List", "Failure preparing request")
53
resp, err := client.ListSender(req)
55
result.Response = autorest.Response{Response: resp}
56
return result, autorest.NewErrorWithError(err, "compute/VirtualMachineSizesClient", "List", "Failure sending request")
59
result, err = client.ListResponder(resp)
61
ae = autorest.NewErrorWithError(err, "compute/VirtualMachineSizesClient", "List", "Failure responding to request")
67
// ListPreparer prepares the List request.
68
func (client VirtualMachineSizesClient) ListPreparer(location string) (*http.Request, error) {
69
pathParameters := map[string]interface{}{
70
"location": url.QueryEscape(location),
71
"subscriptionId": url.QueryEscape(client.SubscriptionID),
74
queryParameters := map[string]interface{}{
75
"api-version": APIVersion,
78
return autorest.Prepare(&http.Request{},
81
autorest.WithBaseURL(client.BaseURI),
82
autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes"),
83
autorest.WithPathParameters(pathParameters),
84
autorest.WithQueryParameters(queryParameters))
87
// ListSender sends the List request. The method will close the
88
// http.Response Body if it receives an error.
89
func (client VirtualMachineSizesClient) ListSender(req *http.Request) (*http.Response, error) {
90
return client.Send(req, http.StatusOK)
93
// ListResponder handles the response to the List request. The method always
94
// closes the http.Response Body.
95
func (client VirtualMachineSizesClient) ListResponder(resp *http.Response) (result VirtualMachineSizeListResult, err error) {
96
err = autorest.Respond(
98
client.ByInspecting(),
99
autorest.WithErrorUnlessStatusCode(http.StatusOK),
100
autorest.ByUnmarshallingJSON(&result),
101
autorest.ByClosing())
102
result.Response = autorest.Response{Response: resp}