~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/Azure/azure-sdk-for-go/arm/compute/virtualmachinesizes.go

  • Committer: Nicholas Skaggs
  • Date: 2016-10-24 20:56:05 UTC
  • Revision ID: nicholas.skaggs@canonical.com-20161024205605-z8lta0uvuhtxwzwl
Initi with beta15

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package compute
 
2
 
 
3
// Copyright (c) Microsoft and contributors.  All rights reserved.
 
4
//
 
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
 
9
//
 
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.
 
13
//
 
14
// See the License for the specific language governing permissions and
 
15
// limitations under the License.
 
16
//
 
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
 
19
// regenerated.
 
20
 
 
21
import (
 
22
        "github.com/Azure/azure-sdk-for-go/Godeps/_workspace/src/github.com/Azure/go-autorest/autorest"
 
23
        "net/http"
 
24
        "net/url"
 
25
)
 
26
 
 
27
// VirtualMachineSizesClient is the the Compute Management Client.
 
28
type VirtualMachineSizesClient struct {
 
29
        ManagementClient
 
30
}
 
31
 
 
32
// NewVirtualMachineSizesClient creates an instance of the
 
33
// VirtualMachineSizesClient client.
 
34
func NewVirtualMachineSizesClient(subscriptionID string) VirtualMachineSizesClient {
 
35
        return NewVirtualMachineSizesClientWithBaseURI(DefaultBaseURI, subscriptionID)
 
36
}
 
37
 
 
38
// NewVirtualMachineSizesClientWithBaseURI creates an instance of the
 
39
// VirtualMachineSizesClient client.
 
40
func NewVirtualMachineSizesClientWithBaseURI(baseURI string, subscriptionID string) VirtualMachineSizesClient {
 
41
        return VirtualMachineSizesClient{NewWithBaseURI(baseURI, subscriptionID)}
 
42
}
 
43
 
 
44
// List lists virtual-machine-sizes available in a location for a subscription.
 
45
//
 
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)
 
49
        if err != nil {
 
50
                return result, autorest.NewErrorWithError(err, "compute/VirtualMachineSizesClient", "List", "Failure preparing request")
 
51
        }
 
52
 
 
53
        resp, err := client.ListSender(req)
 
54
        if err != nil {
 
55
                result.Response = autorest.Response{Response: resp}
 
56
                return result, autorest.NewErrorWithError(err, "compute/VirtualMachineSizesClient", "List", "Failure sending request")
 
57
        }
 
58
 
 
59
        result, err = client.ListResponder(resp)
 
60
        if err != nil {
 
61
                ae = autorest.NewErrorWithError(err, "compute/VirtualMachineSizesClient", "List", "Failure responding to request")
 
62
        }
 
63
 
 
64
        return
 
65
}
 
66
 
 
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),
 
72
        }
 
73
 
 
74
        queryParameters := map[string]interface{}{
 
75
                "api-version": APIVersion,
 
76
        }
 
77
 
 
78
        return autorest.Prepare(&http.Request{},
 
79
                autorest.AsJSON(),
 
80
                autorest.AsGet(),
 
81
                autorest.WithBaseURL(client.BaseURI),
 
82
                autorest.WithPath("/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/vmSizes"),
 
83
                autorest.WithPathParameters(pathParameters),
 
84
                autorest.WithQueryParameters(queryParameters))
 
85
}
 
86
 
 
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)
 
91
}
 
92
 
 
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(
 
97
                resp,
 
98
                client.ByInspecting(),
 
99
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
100
                autorest.ByUnmarshallingJSON(&result),
 
101
                autorest.ByClosing())
 
102
        result.Response = autorest.Response{Response: resp}
 
103
        return
 
104
}