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
// RoutesClient is the the Windows Azure Network management API provides a
28
// RESTful set of web services that interact with Windows Azure Networks
29
// service to manage your network resrources. The API has entities that
30
// capture the relationship between an end user and the Windows Azure
32
type RoutesClient struct {
36
// NewRoutesClient creates an instance of the RoutesClient client.
37
func NewRoutesClient(subscriptionID string) RoutesClient {
38
return NewRoutesClientWithBaseURI(DefaultBaseURI, subscriptionID)
41
// NewRoutesClientWithBaseURI creates an instance of the RoutesClient client.
42
func NewRoutesClientWithBaseURI(baseURI string, subscriptionID string) RoutesClient {
43
return RoutesClient{NewWithBaseURI(baseURI, subscriptionID)}
46
// CreateOrUpdate the Put route operation creates/updates a route in the
47
// specified route table
49
// resourceGroupName is the name of the resource group. routeTableName is the
50
// name of the route table. routeName is the name of the route.
51
// routeParameters is parameters supplied to the create/update routeoperation
52
func (client RoutesClient) CreateOrUpdate(resourceGroupName string, routeTableName string, routeName string, routeParameters Route) (result Route, ae error) {
53
req, err := client.CreateOrUpdatePreparer(resourceGroupName, routeTableName, routeName, routeParameters)
55
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "CreateOrUpdate", "Failure preparing request")
58
resp, err := client.CreateOrUpdateSender(req)
60
result.Response = autorest.Response{Response: resp}
61
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "CreateOrUpdate", "Failure sending request")
64
result, err = client.CreateOrUpdateResponder(resp)
66
ae = autorest.NewErrorWithError(err, "network/RoutesClient", "CreateOrUpdate", "Failure responding to request")
72
// CreateOrUpdatePreparer prepares the CreateOrUpdate request.
73
func (client RoutesClient) CreateOrUpdatePreparer(resourceGroupName string, routeTableName string, routeName string, routeParameters Route) (*http.Request, error) {
74
pathParameters := map[string]interface{}{
75
"resourceGroupName": url.QueryEscape(resourceGroupName),
76
"routeName": url.QueryEscape(routeName),
77
"routeTableName": url.QueryEscape(routeTableName),
78
"subscriptionId": url.QueryEscape(client.SubscriptionID),
81
queryParameters := map[string]interface{}{
82
"api-version": APIVersion,
85
return autorest.Prepare(&http.Request{},
88
autorest.WithBaseURL(client.BaseURI),
89
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}"),
90
autorest.WithJSON(routeParameters),
91
autorest.WithPathParameters(pathParameters),
92
autorest.WithQueryParameters(queryParameters))
95
// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the
96
// http.Response Body if it receives an error.
97
func (client RoutesClient) CreateOrUpdateSender(req *http.Request) (*http.Response, error) {
98
return client.Send(req, http.StatusCreated, http.StatusOK)
101
// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always
102
// closes the http.Response Body.
103
func (client RoutesClient) CreateOrUpdateResponder(resp *http.Response) (result Route, err error) {
104
err = autorest.Respond(
106
client.ByInspecting(),
107
autorest.WithErrorUnlessStatusCode(http.StatusCreated, http.StatusOK),
108
autorest.ByUnmarshallingJSON(&result),
109
autorest.ByClosing())
110
result.Response = autorest.Response{Response: resp}
114
// Delete the delete route operation deletes the specified route from a route
117
// resourceGroupName is the name of the resource group. routeTableName is the
118
// name of the route table. routeName is the name of the route.
119
func (client RoutesClient) Delete(resourceGroupName string, routeTableName string, routeName string) (result autorest.Response, ae error) {
120
req, err := client.DeletePreparer(resourceGroupName, routeTableName, routeName)
122
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "Delete", "Failure preparing request")
125
resp, err := client.DeleteSender(req)
127
result.Response = resp
128
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "Delete", "Failure sending request")
131
result, err = client.DeleteResponder(resp)
133
ae = autorest.NewErrorWithError(err, "network/RoutesClient", "Delete", "Failure responding to request")
139
// DeletePreparer prepares the Delete request.
140
func (client RoutesClient) DeletePreparer(resourceGroupName string, routeTableName string, routeName string) (*http.Request, error) {
141
pathParameters := map[string]interface{}{
142
"resourceGroupName": url.QueryEscape(resourceGroupName),
143
"routeName": url.QueryEscape(routeName),
144
"routeTableName": url.QueryEscape(routeTableName),
145
"subscriptionId": url.QueryEscape(client.SubscriptionID),
148
queryParameters := map[string]interface{}{
149
"api-version": APIVersion,
152
return autorest.Prepare(&http.Request{},
155
autorest.WithBaseURL(client.BaseURI),
156
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}"),
157
autorest.WithPathParameters(pathParameters),
158
autorest.WithQueryParameters(queryParameters))
161
// DeleteSender sends the Delete request. The method will close the
162
// http.Response Body if it receives an error.
163
func (client RoutesClient) DeleteSender(req *http.Request) (*http.Response, error) {
164
return client.Send(req, http.StatusNoContent, http.StatusAccepted, http.StatusOK)
167
// DeleteResponder handles the response to the Delete request. The method always
168
// closes the http.Response Body.
169
func (client RoutesClient) DeleteResponder(resp *http.Response) (result autorest.Response, err error) {
170
err = autorest.Respond(
172
client.ByInspecting(),
173
autorest.WithErrorUnlessStatusCode(http.StatusNoContent, http.StatusAccepted, http.StatusOK),
174
autorest.ByClosing())
175
result.Response = resp
179
// Get the Get route operation retreives information about the specified route
180
// from the route table.
182
// resourceGroupName is the name of the resource group. routeTableName is the
183
// name of the route table. routeName is the name of the route.
184
func (client RoutesClient) Get(resourceGroupName string, routeTableName string, routeName string) (result Route, ae error) {
185
req, err := client.GetPreparer(resourceGroupName, routeTableName, routeName)
187
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "Get", "Failure preparing request")
190
resp, err := client.GetSender(req)
192
result.Response = autorest.Response{Response: resp}
193
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "Get", "Failure sending request")
196
result, err = client.GetResponder(resp)
198
ae = autorest.NewErrorWithError(err, "network/RoutesClient", "Get", "Failure responding to request")
204
// GetPreparer prepares the Get request.
205
func (client RoutesClient) GetPreparer(resourceGroupName string, routeTableName string, routeName string) (*http.Request, error) {
206
pathParameters := map[string]interface{}{
207
"resourceGroupName": url.QueryEscape(resourceGroupName),
208
"routeName": url.QueryEscape(routeName),
209
"routeTableName": url.QueryEscape(routeTableName),
210
"subscriptionId": url.QueryEscape(client.SubscriptionID),
213
queryParameters := map[string]interface{}{
214
"api-version": APIVersion,
217
return autorest.Prepare(&http.Request{},
220
autorest.WithBaseURL(client.BaseURI),
221
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes/{routeName}"),
222
autorest.WithPathParameters(pathParameters),
223
autorest.WithQueryParameters(queryParameters))
226
// GetSender sends the Get request. The method will close the
227
// http.Response Body if it receives an error.
228
func (client RoutesClient) GetSender(req *http.Request) (*http.Response, error) {
229
return client.Send(req, http.StatusOK)
232
// GetResponder handles the response to the Get request. The method always
233
// closes the http.Response Body.
234
func (client RoutesClient) GetResponder(resp *http.Response) (result Route, err error) {
235
err = autorest.Respond(
237
client.ByInspecting(),
238
autorest.WithErrorUnlessStatusCode(http.StatusOK),
239
autorest.ByUnmarshallingJSON(&result),
240
autorest.ByClosing())
241
result.Response = autorest.Response{Response: resp}
245
// List the List network security rule opertion retrieves all the routes in a
248
// resourceGroupName is the name of the resource group. routeTableName is the
249
// name of the route table.
250
func (client RoutesClient) List(resourceGroupName string, routeTableName string) (result RouteListResult, ae error) {
251
req, err := client.ListPreparer(resourceGroupName, routeTableName)
253
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "List", "Failure preparing request")
256
resp, err := client.ListSender(req)
258
result.Response = autorest.Response{Response: resp}
259
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "List", "Failure sending request")
262
result, err = client.ListResponder(resp)
264
ae = autorest.NewErrorWithError(err, "network/RoutesClient", "List", "Failure responding to request")
270
// ListPreparer prepares the List request.
271
func (client RoutesClient) ListPreparer(resourceGroupName string, routeTableName string) (*http.Request, error) {
272
pathParameters := map[string]interface{}{
273
"resourceGroupName": url.QueryEscape(resourceGroupName),
274
"routeTableName": url.QueryEscape(routeTableName),
275
"subscriptionId": url.QueryEscape(client.SubscriptionID),
278
queryParameters := map[string]interface{}{
279
"api-version": APIVersion,
282
return autorest.Prepare(&http.Request{},
285
autorest.WithBaseURL(client.BaseURI),
286
autorest.WithPath("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/routeTables/{routeTableName}/routes"),
287
autorest.WithPathParameters(pathParameters),
288
autorest.WithQueryParameters(queryParameters))
291
// ListSender sends the List request. The method will close the
292
// http.Response Body if it receives an error.
293
func (client RoutesClient) ListSender(req *http.Request) (*http.Response, error) {
294
return client.Send(req, http.StatusOK)
297
// ListResponder handles the response to the List request. The method always
298
// closes the http.Response Body.
299
func (client RoutesClient) ListResponder(resp *http.Response) (result RouteListResult, err error) {
300
err = autorest.Respond(
302
client.ByInspecting(),
303
autorest.WithErrorUnlessStatusCode(http.StatusOK),
304
autorest.ByUnmarshallingJSON(&result),
305
autorest.ByClosing())
306
result.Response = autorest.Response{Response: resp}
310
// ListNextResults retrieves the next set of results, if any.
311
func (client RoutesClient) ListNextResults(lastResults RouteListResult) (result RouteListResult, ae error) {
312
req, err := lastResults.RouteListResultPreparer()
314
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "List", "Failure preparing next results request request")
320
resp, err := client.ListSender(req)
322
result.Response = autorest.Response{Response: resp}
323
return result, autorest.NewErrorWithError(err, "network/RoutesClient", "List", "Failure sending next results request request")
326
result, err = client.ListResponder(resp)
328
ae = autorest.NewErrorWithError(err, "network/RoutesClient", "List", "Failure responding to next results request request")