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
// 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 {
36
// NewVirtualNetworkGatewaysClient creates an instance of the
37
// VirtualNetworkGatewaysClient client.
38
func NewVirtualNetworkGatewaysClient(subscriptionID string) VirtualNetworkGatewaysClient {
39
return NewVirtualNetworkGatewaysClientWithBaseURI(DefaultBaseURI, subscriptionID)
42
// NewVirtualNetworkGatewaysClientWithBaseURI creates an instance of the
43
// VirtualNetworkGatewaysClient client.
44
func NewVirtualNetworkGatewaysClientWithBaseURI(baseURI string, subscriptionID string) VirtualNetworkGatewaysClient {
45
return VirtualNetworkGatewaysClient{NewWithBaseURI(baseURI, subscriptionID)}
48
// CreateOrUpdate the Put VirtualNetworkGateway operation creates/updates a
49
// virtual network gateway in the specified resource group through Network
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)
59
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "CreateOrUpdate", "Failure preparing request")
62
resp, err := client.CreateOrUpdateSender(req)
64
result.Response = autorest.Response{Response: resp}
65
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "CreateOrUpdate", "Failure sending request")
68
result, err = client.CreateOrUpdateResponder(resp)
70
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "CreateOrUpdate", "Failure responding to request")
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),
84
queryParameters := map[string]interface{}{
85
"api-version": APIVersion,
88
return autorest.Prepare(&http.Request{},
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))
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)
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(
109
client.ByInspecting(),
110
autorest.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
111
autorest.ByUnmarshallingJSON(&result),
112
autorest.ByClosing())
113
result.Response = autorest.Response{Response: resp}
117
// Delete the Delete VirtualNetworkGateway operation deletes the specifed
118
// virtual network Gateway through Network resource provider.
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)
125
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Delete", "Failure preparing request")
128
resp, err := client.DeleteSender(req)
130
result.Response = resp
131
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Delete", "Failure sending request")
134
result, err = client.DeleteResponder(resp)
136
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Delete", "Failure responding to request")
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),
150
queryParameters := map[string]interface{}{
151
"api-version": APIVersion,
154
return autorest.Prepare(&http.Request{},
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))
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)
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(
174
client.ByInspecting(),
175
autorest.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK),
176
autorest.ByClosing())
177
result.Response = resp
181
// Get the Get VirtualNetworkGateway operation retrieves information about the
182
// specified virtual network gateway through Network resource provider.
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)
189
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Get", "Failure preparing request")
192
resp, err := client.GetSender(req)
194
result.Response = autorest.Response{Response: resp}
195
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Get", "Failure sending request")
198
result, err = client.GetResponder(resp)
200
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Get", "Failure responding to request")
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),
214
queryParameters := map[string]interface{}{
215
"api-version": APIVersion,
218
return autorest.Prepare(&http.Request{},
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))
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)
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(
238
client.ByInspecting(),
239
autorest.WithErrorUnlessStatusCode(http.StatusOK),
240
autorest.ByUnmarshallingJSON(&result),
241
autorest.ByClosing())
242
result.Response = autorest.Response{Response: resp}
246
// List the List VirtualNetworkGateways opertion retrieves all the virtual
247
// network gateways stored.
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)
253
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", "Failure preparing request")
256
resp, err := client.ListSender(req)
258
result.Response = autorest.Response{Response: resp}
259
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", "Failure sending request")
262
result, err = client.ListResponder(resp)
264
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", "Failure responding to request")
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),
277
queryParameters := map[string]interface{}{
278
"api-version": APIVersion,
281
return autorest.Prepare(&http.Request{},
284
autorest.WithBaseURL(client.BaseURI),
285
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworkGateways"),
286
autorest.WithPathParameters(pathParameters),
287
autorest.WithQueryParameters(queryParameters))
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)
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(
301
client.ByInspecting(),
302
autorest.WithErrorUnlessStatusCode(http.StatusOK),
303
autorest.ByUnmarshallingJSON(&result),
304
autorest.ByClosing())
305
result.Response = autorest.Response{Response: resp}
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()
313
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", "Failure preparing next results request request")
319
resp, err := client.ListSender(req)
321
result.Response = autorest.Response{Response: resp}
322
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", "Failure sending next results request request")
325
result, err = client.ListResponder(resp)
327
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "List", "Failure responding to next results request request")
333
// Reset the Reset VirtualNetworkGateway operation resets the primary of the
334
// virtual network gatewayin the specified resource group through Network
335
// resource provider.
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)
344
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Reset", "Failure preparing request")
347
resp, err := client.ResetSender(req)
349
result.Response = autorest.Response{Response: resp}
350
return result, autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Reset", "Failure sending request")
353
result, err = client.ResetResponder(resp)
355
ae = autorest.NewErrorWithError(err, "network/VirtualNetworkGatewaysClient", "Reset", "Failure responding to request")
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),
369
queryParameters := map[string]interface{}{
370
"api-version": APIVersion,
373
return autorest.Prepare(&http.Request{},
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))
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)
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(
394
client.ByInspecting(),
395
autorest.WithErrorUnlessStatusCode(http.StatusAccepted, http.StatusOK),
396
autorest.ByUnmarshallingJSON(&result),
397
autorest.ByClosing())
398
result.Response = autorest.Response{Response: resp}