~nskaggs/+junk/xenial-test

« back to all changes in this revision

Viewing changes to src/github.com/Azure/azure-sdk-for-go/arm/network/virtualnetworkgateways.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 network
 
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
// VirtualNetworkGatewaysClient is the the Windows Azure Network management
 
28
// API provides a RESTful set of web services that interact with Windows
 
29
// Azure Networks service to manage your network resrources. The API has
 
30
// entities that capture the relationship between an end user and the Windows
 
31
// Azure Networks service.
 
32
type VirtualNetworkGatewaysClient struct {
 
33
        ManagementClient
 
34
}
 
35
 
 
36
// NewVirtualNetworkGatewaysClient creates an instance of the
 
37
// VirtualNetworkGatewaysClient client.
 
38
func NewVirtualNetworkGatewaysClient(subscriptionID string) VirtualNetworkGatewaysClient {
 
39
        return NewVirtualNetworkGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID)
 
40
}
 
41
 
 
42
// NewVirtualNetworkGatewaysClientWithBaseURI creates an instance of the
 
43
// VirtualNetworkGatewaysClient client.
 
44
func NewVirtualNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkGatewaysClient {
 
45
        return VirtualNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)}
 
46
}
 
47
 
 
48
// CreateOrUpdate the Put VirtualNetworkGateway operation creates/updates a
 
49
// virtual network gateway in the specified resource group through Network
 
50
// resource provider.
 
51
//
 
52
// resourceGroupName is the name of the resource group.
 
53
// virtualNetworkGatewayName is the name of the virtual network gateway.
 
54
// parameters is parameters supplied to the Begin Create or update Virtual
 
55
// Network Gateway operation through Network resource provider.
 
56
func (client VirtualNetworkGatewaysClient) CreateOrUpdate(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway) (result VirtualNetworkGateway, ae error) {
 
57
        req, err := client.CreateOrUpdatePreparer(resourceGroupName, virtualNetworkGatewayName, parameters)
 
58
        if err != nil {
 
59
                return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "CreateOrUpdate", "Failure preparing request")
 
60
        }
 
61
 
 
62
        resp, err := client.CreateOrUpdateSender(req)
 
63
        if err != nil {
 
64
                result.Response = autorest.Response{Response: resp}
 
65
                return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "CreateOrUpdate", "Failure sending request")
 
66
        }
 
67
 
 
68
        result, err = client.CreateOrUpdateResponder(resp)
 
69
        if err != nil {
 
70
                ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "CreateOrUpdate", "Failure responding to request")
 
71
        }
 
72
 
 
73
        return
 
74
}
 
75
 
 
76
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
 
77
func (client VirtualNetworkGatewaysClient) CreateOrUpdatePreparer(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway) (*http.Request, error) {
 
78
        pathParameters := map[string]interface{}{
 
79
                "resourceGroupName":         url.QueryEscape(resourceGroupName),
 
80
                "subscriptionId":            url.QueryEscape(client.SubscriptionID),
 
81
                "virtualNetworkGatewayName": url.QueryEscape(virtualNetworkGatewayName),
 
82
        }
 
83
 
 
84
        queryParameters := map[string]interface{}{
 
85
                "api-version": APIVersion,
 
86
        }
 
87
 
 
88
        return autorest.Prepare(&http.Request{},
 
89
                autorest.AsJSON(),
 
90
                autorest.AsPut(),
 
91
                autorest.WithBaseURL(client.BaseURI),
 
92
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualnetworkgateways/{virtualNetworkGatewayName}"),
 
93
                autorest.WithJSON(parameters),
 
94
                autorest.WithPathParameters(pathParameters),
 
95
                autorest.WithQueryParameters(queryParameters))
 
96
}
 
97
 
 
98
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
 
99
// http.Response Body if it receives an error.
 
100
func (client VirtualNetworkGatewaysClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
 
101
        return client.Send(req, http.StatusCreated, http.StatusOK)
 
102
}
 
103
 
 
104
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
 
105
// closes the http.Response Body.
 
106
func (client VirtualNetworkGatewaysClient) CreateOrUpdateResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
 
107
        err = autorest.Respond(
 
108
                resp,
 
109
                client.ByInspecting(),
 
110
                autorest.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
 
111
                autorest.ByUnmarshallingJSON(&result),
 
112
                autorest.ByClosing())
 
113
        result.Response = autorest.Response{Response: resp}
 
114
        return
 
115
}
 
116
 
 
117
// Delete the Delete VirtualNetworkGateway operation deletes the specifed
 
118
// virtual network Gateway through Network resource provider.
 
119
//
 
120
// resourceGroupName is the name of the resource group.
 
121
// virtualNetworkGatewayName is the name of the virtual network gateway.
 
122
func (client VirtualNetworkGatewaysClient) Delete(resourceGroupName string, virtualNetworkGatewayName string) (result autorest.Response, ae error) {
 
123
        req, err := client.DeletePreparer(resourceGroupName, virtualNetworkGatewayName)
 
124
        if err != nil {
 
125
                return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Delete", "Failure preparing request")
 
126
        }
 
127
 
 
128
        resp, err := client.DeleteSender(req)
 
129
        if err != nil {
 
130
                result.Response = resp
 
131
                return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Delete", "Failure sending request")
 
132
        }
 
133
 
 
134
        result, err = client.DeleteResponder(resp)
 
135
        if err != nil {
 
136
                ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Delete", "Failure responding to request")
 
137
        }
 
138
 
 
139
        return
 
140
}
 
141
 
 
142
// DeletePreparer prepares the Delete request.
 
143
func (client VirtualNetworkGatewaysClient) DeletePreparer(resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
 
144
        pathParameters := map[string]interface{}{
 
145
                "resourceGroupName":         url.QueryEscape(resourceGroupName),
 
146
                "subscriptionId":            url.QueryEscape(client.SubscriptionID),
 
147
                "virtualNetworkGatewayName": url.QueryEscape(virtualNetworkGatewayName),
 
148
        }
 
149
 
 
150
        queryParameters := map[string]interface{}{
 
151
                "api-version": APIVersion,
 
152
        }
 
153
 
 
154
        return autorest.Prepare(&http.Request{},
 
155
                autorest.AsJSON(),
 
156
                autorest.AsDelete(),
 
157
                autorest.WithBaseURL(client.BaseURI),
 
158
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways/{virtualNetworkGatewayName}/"),
 
159
                autorest.WithPathParameters(pathParameters),
 
160
                autorest.WithQueryParameters(queryParameters))
 
161
}
 
162
 
 
163
// DeleteSender sends the Delete request. The method will close the
 
164
// http.Response Body if it receives an error.
 
165
func (client VirtualNetworkGatewaysClient) DeleteSender(req *http.Request) (*http.Response, error) {
 
166
        return client.Send(req, http.StatusNoContent, http.StatusAccepted, http.StatusOK)
 
167
}
 
168
 
 
169
// DeleteResponder handles the response to the Delete request. The method always
 
170
// closes the http.Response Body.
 
171
func (client VirtualNetworkGatewaysClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
 
172
        err = autorest.Respond(
 
173
                resp,
 
174
                client.ByInspecting(),
 
175
                autorest.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK),
 
176
                autorest.ByClosing())
 
177
        result.Response = resp
 
178
        return
 
179
}
 
180
 
 
181
// Get the Get VirtualNetworkGateway operation retrieves information about the
 
182
// specified virtual network gateway through Network resource provider.
 
183
//
 
184
// resourceGroupName is the name of the resource group.
 
185
// virtualNetworkGatewayName is the name of the virtual network gateway.
 
186
func (client VirtualNetworkGatewaysClient) Get(resourceGroupName string, virtualNetworkGatewayName string) (result VirtualNetworkGateway, ae error) {
 
187
        req, err := client.GetPreparer(resourceGroupName, virtualNetworkGatewayName)
 
188
        if err != nil {
 
189
                return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Get", "Failure preparing request")
 
190
        }
 
191
 
 
192
        resp, err := client.GetSender(req)
 
193
        if err != nil {
 
194
                result.Response = autorest.Response{Response: resp}
 
195
                return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Get", "Failure sending request")
 
196
        }
 
197
 
 
198
        result, err = client.GetResponder(resp)
 
199
        if err != nil {
 
200
                ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Get", "Failure responding to request")
 
201
        }
 
202
 
 
203
        return
 
204
}
 
205
 
 
206
// GetPreparer prepares the Get request.
 
207
func (client VirtualNetworkGatewaysClient) GetPreparer(resourceGroupName string, virtualNetworkGatewayName string) (*http.Request, error) {
 
208
        pathParameters := map[string]interface{}{
 
209
                "resourceGroupName":         url.QueryEscape(resourceGroupName),
 
210
                "subscriptionId":            url.QueryEscape(client.SubscriptionID),
 
211
                "virtualNetworkGatewayName": url.QueryEscape(virtualNetworkGatewayName),
 
212
        }
 
213
 
 
214
        queryParameters := map[string]interface{}{
 
215
                "api-version": APIVersion,
 
216
        }
 
217
 
 
218
        return autorest.Prepare(&http.Request{},
 
219
                autorest.AsJSON(),
 
220
                autorest.AsGet(),
 
221
                autorest.WithBaseURL(client.BaseURI),
 
222
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualnetworkgateways/{virtualNetworkGatewayName}"),
 
223
                autorest.WithPathParameters(pathParameters),
 
224
                autorest.WithQueryParameters(queryParameters))
 
225
}
 
226
 
 
227
// GetSender sends the Get request. The method will close the
 
228
// http.Response Body if it receives an error.
 
229
func (client VirtualNetworkGatewaysClient) GetSender(req *http.Request) (*http.Response, error) {
 
230
        return client.Send(req, http.StatusOK)
 
231
}
 
232
 
 
233
// GetResponder handles the response to the Get request. The method always
 
234
// closes the http.Response Body.
 
235
func (client VirtualNetworkGatewaysClient) GetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
 
236
        err = autorest.Respond(
 
237
                resp,
 
238
                client.ByInspecting(),
 
239
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
240
                autorest.ByUnmarshallingJSON(&result),
 
241
                autorest.ByClosing())
 
242
        result.Response = autorest.Response{Response: resp}
 
243
        return
 
244
}
 
245
 
 
246
// List the List VirtualNetworkGateways opertion retrieves all the virtual
 
247
// network gateways stored.
 
248
//
 
249
// resourceGroupName is the name of the resource group.
 
250
func (client VirtualNetworkGatewaysClient) List(resourceGroupName string) (result VirtualNetworkGatewayListResult, ae error) {
 
251
        req, err := client.ListPreparer(resourceGroupName)
 
252
        if err != nil {
 
253
                return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", "Failure preparing request")
 
254
        }
 
255
 
 
256
        resp, err := client.ListSender(req)
 
257
        if err != nil {
 
258
                result.Response = autorest.Response{Response: resp}
 
259
                return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", "Failure sending request")
 
260
        }
 
261
 
 
262
        result, err = client.ListResponder(resp)
 
263
        if err != nil {
 
264
                ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", "Failure responding to request")
 
265
        }
 
266
 
 
267
        return
 
268
}
 
269
 
 
270
// ListPreparer prepares the List request.
 
271
func (client VirtualNetworkGatewaysClient) ListPreparer(resourceGroupName string) (*http.Request, error) {
 
272
        pathParameters := map[string]interface{}{
 
273
                "resourceGroupName": url.QueryEscape(resourceGroupName),
 
274
                "subscriptionId":    url.QueryEscape(client.SubscriptionID),
 
275
        }
 
276
 
 
277
        queryParameters := map[string]interface{}{
 
278
                "api-version": APIVersion,
 
279
        }
 
280
 
 
281
        return autorest.Prepare(&http.Request{},
 
282
                autorest.AsJSON(),
 
283
                autorest.AsGet(),
 
284
                autorest.WithBaseURL(client.BaseURI),
 
285
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways"),
 
286
                autorest.WithPathParameters(pathParameters),
 
287
                autorest.WithQueryParameters(queryParameters))
 
288
}
 
289
 
 
290
// ListSender sends the List request. The method will close the
 
291
// http.Response Body if it receives an error.
 
292
func (client VirtualNetworkGatewaysClient) ListSender(req *http.Request) (*http.Response, error) {
 
293
        return client.Send(req, http.StatusOK)
 
294
}
 
295
 
 
296
// ListResponder handles the response to the List request. The method always
 
297
// closes the http.Response Body.
 
298
func (client VirtualNetworkGatewaysClient) ListResponder(resp *http.Response) (result VirtualNetworkGatewayListResult, err error) {
 
299
        err = autorest.Respond(
 
300
                resp,
 
301
                client.ByInspecting(),
 
302
                autorest.WithErrorUnlessStatusCode(http.StatusOK),
 
303
                autorest.ByUnmarshallingJSON(&result),
 
304
                autorest.ByClosing())
 
305
        result.Response = autorest.Response{Response: resp}
 
306
        return
 
307
}
 
308
 
 
309
// ListNextResults retrieves the next set of results, if any.
 
310
func (client VirtualNetworkGatewaysClient) ListNextResults(lastResults VirtualNetworkGatewayListResult) (result VirtualNetworkGatewayListResult, ae error) {
 
311
        req, err := lastResults.VirtualNetworkGatewayListResultPreparer()
 
312
        if err != nil {
 
313
                return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", "Failure preparing next results request request")
 
314
        }
 
315
        if req == nil {
 
316
                return
 
317
        }
 
318
 
 
319
        resp, err := client.ListSender(req)
 
320
        if err != nil {
 
321
                result.Response = autorest.Response{Response: resp}
 
322
                return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", "Failure sending next results request request")
 
323
        }
 
324
 
 
325
        result, err = client.ListResponder(resp)
 
326
        if err != nil {
 
327
                ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", "Failure responding to next results request request")
 
328
        }
 
329
 
 
330
        return
 
331
}
 
332
 
 
333
// Reset the Reset VirtualNetworkGateway operation resets the primary of the
 
334
// virtual network gatewayin the specified resource group through Network
 
335
// resource provider.
 
336
//
 
337
// resourceGroupName is the name of the resource group.
 
338
// virtualNetworkGatewayName is the name of the virtual network gateway.
 
339
// parameters is parameters supplied to the Begin Reset Virtual Network
 
340
// Gateway operation through Network resource provider.
 
341
func (client VirtualNetworkGatewaysClient) Reset(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway) (result VirtualNetworkGateway, ae error) {
 
342
        req, err := client.ResetPreparer(resourceGroupName, virtualNetworkGatewayName, parameters)
 
343
        if err != nil {
 
344
                return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Reset", "Failure preparing request")
 
345
        }
 
346
 
 
347
        resp, err := client.ResetSender(req)
 
348
        if err != nil {
 
349
                result.Response = autorest.Response{Response: resp}
 
350
                return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Reset", "Failure sending request")
 
351
        }
 
352
 
 
353
        result, err = client.ResetResponder(resp)
 
354
        if err != nil {
 
355
                ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Reset", "Failure responding to request")
 
356
        }
 
357
 
 
358
        return
 
359
}
 
360
 
 
361
// ResetPreparer prepares the Reset request.
 
362
func (client VirtualNetworkGatewaysClient) ResetPreparer(resourceGroupName string, virtualNetworkGatewayName string, parameters VirtualNetworkGateway) (*http.Request, error) {
 
363
        pathParameters := map[string]interface{}{
 
364
                "resourceGroupName":         url.QueryEscape(resourceGroupName),
 
365
                "subscriptionId":            url.QueryEscape(client.SubscriptionID),
 
366
                "virtualNetworkGatewayName": url.QueryEscape(virtualNetworkGatewayName),
 
367
        }
 
368
 
 
369
        queryParameters := map[string]interface{}{
 
370
                "api-version": APIVersion,
 
371
        }
 
372
 
 
373
        return autorest.Prepare(&http.Request{},
 
374
                autorest.AsJSON(),
 
375
                autorest.AsPost(),
 
376
                autorest.WithBaseURL(client.BaseURI),
 
377
                autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualnetworkgateways/{virtualNetworkGatewayName}/reset"),
 
378
                autorest.WithJSON(parameters),
 
379
                autorest.WithPathParameters(pathParameters),
 
380
                autorest.WithQueryParameters(queryParameters))
 
381
}
 
382
 
 
383
// ResetSender sends the Reset request. The method will close the
 
384
// http.Response Body if it receives an error.
 
385
func (client VirtualNetworkGatewaysClient) ResetSender(req *http.Request) (*http.Response, error) {
 
386
        return client.Send(req, http.StatusAccepted, http.StatusOK)
 
387
}
 
388
 
 
389
// ResetResponder handles the response to the Reset request. The method always
 
390
// closes the http.Response Body.
 
391
func (client VirtualNetworkGatewaysClient) ResetResponder(resp *http.Response) (result VirtualNetworkGateway, err error) {
 
392
        err = autorest.Respond(
 
393
                resp,
 
394
                client.ByInspecting(),
 
395
                autorest.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK),
 
396
                autorest.ByUnmarshallingJSON(&result),
 
397
                autorest.ByClosing())
 
398
        result.Response = autorest.Response{Response: resp}
 
399
        return
 
400
}