1package 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. 18// Changes may cause incorrect behavior and will be lost if the code is regenerated. 19 20import ( 21 "context" 22 "github.com/Azure/go-autorest/autorest" 23 "github.com/Azure/go-autorest/autorest/azure" 24 "github.com/Azure/go-autorest/tracing" 25 "net/http" 26) 27 28// ExpressRouteCrossConnectionsClient is the network Client 29type ExpressRouteCrossConnectionsClient struct { 30 BaseClient 31} 32 33// NewExpressRouteCrossConnectionsClient creates an instance of the ExpressRouteCrossConnectionsClient client. 34func NewExpressRouteCrossConnectionsClient(subscriptionID string) ExpressRouteCrossConnectionsClient { 35 return NewExpressRouteCrossConnectionsClientWithBaseURI(DefaultBaseURI, subscriptionID) 36} 37 38// NewExpressRouteCrossConnectionsClientWithBaseURI creates an instance of the ExpressRouteCrossConnectionsClient 39// client using a custom endpoint. Use this when interacting with an Azure cloud that uses a non-standard base URI 40// (sovereign clouds, Azure stack). 41func NewExpressRouteCrossConnectionsClientWithBaseURI(baseURI string, subscriptionID string) ExpressRouteCrossConnectionsClient { 42 return ExpressRouteCrossConnectionsClient{NewWithBaseURI(baseURI, subscriptionID)} 43} 44 45// CreateOrUpdate update the specified ExpressRouteCrossConnection. 46// Parameters: 47// resourceGroupName - the name of the resource group. 48// crossConnectionName - the name of the ExpressRouteCrossConnection. 49// parameters - parameters supplied to the update express route crossConnection operation. 50func (client ExpressRouteCrossConnectionsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, crossConnectionName string, parameters ExpressRouteCrossConnection) (result ExpressRouteCrossConnectionsCreateOrUpdateFuture, err error) { 51 if tracing.IsEnabled() { 52 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.CreateOrUpdate") 53 defer func() { 54 sc := -1 55 if result.Response() != nil { 56 sc = result.Response().StatusCode 57 } 58 tracing.EndSpan(ctx, sc, err) 59 }() 60 } 61 req, err := client.CreateOrUpdatePreparer(ctx, resourceGroupName, crossConnectionName, parameters) 62 if err != nil { 63 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "CreateOrUpdate", nil, "Failure preparing request") 64 return 65 } 66 67 result, err = client.CreateOrUpdateSender(req) 68 if err != nil { 69 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "CreateOrUpdate", result.Response(), "Failure sending request") 70 return 71 } 72 73 return 74} 75 76// CreateOrUpdatePreparer prepares the CreateOrUpdate request. 77func (client ExpressRouteCrossConnectionsClient) CreateOrUpdatePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, parameters ExpressRouteCrossConnection) (*http.Request, error) { 78 pathParameters := map[string]interface{}{ 79 "crossConnectionName": autorest.Encode("path", crossConnectionName), 80 "resourceGroupName": autorest.Encode("path", resourceGroupName), 81 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 82 } 83 84 const APIVersion = "2018-04-01" 85 queryParameters := map[string]interface{}{ 86 "api-version": APIVersion, 87 } 88 89 parameters.Etag = nil 90 preparer := autorest.CreatePreparer( 91 autorest.AsContentType("application/json; charset=utf-8"), 92 autorest.AsPut(), 93 autorest.WithBaseURL(client.BaseURI), 94 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}", pathParameters), 95 autorest.WithJSON(parameters), 96 autorest.WithQueryParameters(queryParameters)) 97 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 98} 99 100// CreateOrUpdateSender sends the CreateOrUpdate request. The method will close the 101// http.Response Body if it receives an error. 102func (client ExpressRouteCrossConnectionsClient) CreateOrUpdateSender(req *http.Request) (future ExpressRouteCrossConnectionsCreateOrUpdateFuture, err error) { 103 var resp *http.Response 104 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 105 if err != nil { 106 return 107 } 108 future.Future, err = azure.NewFutureFromResponse(resp) 109 return 110} 111 112// CreateOrUpdateResponder handles the response to the CreateOrUpdate request. The method always 113// closes the http.Response Body. 114func (client ExpressRouteCrossConnectionsClient) CreateOrUpdateResponder(resp *http.Response) (result ExpressRouteCrossConnection, err error) { 115 err = autorest.Respond( 116 resp, 117 client.ByInspecting(), 118 azure.WithErrorUnlessStatusCode(http.StatusOK), 119 autorest.ByUnmarshallingJSON(&result), 120 autorest.ByClosing()) 121 result.Response = autorest.Response{Response: resp} 122 return 123} 124 125// Get gets details about the specified ExpressRouteCrossConnection. 126// Parameters: 127// resourceGroupName - the name of the resource group (peering location of the circuit). 128// crossConnectionName - the name of the ExpressRouteCrossConnection (service key of the circuit). 129func (client ExpressRouteCrossConnectionsClient) Get(ctx context.Context, resourceGroupName string, crossConnectionName string) (result ExpressRouteCrossConnection, err error) { 130 if tracing.IsEnabled() { 131 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.Get") 132 defer func() { 133 sc := -1 134 if result.Response.Response != nil { 135 sc = result.Response.Response.StatusCode 136 } 137 tracing.EndSpan(ctx, sc, err) 138 }() 139 } 140 req, err := client.GetPreparer(ctx, resourceGroupName, crossConnectionName) 141 if err != nil { 142 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "Get", nil, "Failure preparing request") 143 return 144 } 145 146 resp, err := client.GetSender(req) 147 if err != nil { 148 result.Response = autorest.Response{Response: resp} 149 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "Get", resp, "Failure sending request") 150 return 151 } 152 153 result, err = client.GetResponder(resp) 154 if err != nil { 155 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "Get", resp, "Failure responding to request") 156 } 157 158 return 159} 160 161// GetPreparer prepares the Get request. 162func (client ExpressRouteCrossConnectionsClient) GetPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string) (*http.Request, error) { 163 pathParameters := map[string]interface{}{ 164 "crossConnectionName": autorest.Encode("path", crossConnectionName), 165 "resourceGroupName": autorest.Encode("path", resourceGroupName), 166 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 167 } 168 169 const APIVersion = "2018-04-01" 170 queryParameters := map[string]interface{}{ 171 "api-version": APIVersion, 172 } 173 174 preparer := autorest.CreatePreparer( 175 autorest.AsGet(), 176 autorest.WithBaseURL(client.BaseURI), 177 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}", pathParameters), 178 autorest.WithQueryParameters(queryParameters)) 179 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 180} 181 182// GetSender sends the Get request. The method will close the 183// http.Response Body if it receives an error. 184func (client ExpressRouteCrossConnectionsClient) GetSender(req *http.Request) (*http.Response, error) { 185 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 186} 187 188// GetResponder handles the response to the Get request. The method always 189// closes the http.Response Body. 190func (client ExpressRouteCrossConnectionsClient) GetResponder(resp *http.Response) (result ExpressRouteCrossConnection, err error) { 191 err = autorest.Respond( 192 resp, 193 client.ByInspecting(), 194 azure.WithErrorUnlessStatusCode(http.StatusOK), 195 autorest.ByUnmarshallingJSON(&result), 196 autorest.ByClosing()) 197 result.Response = autorest.Response{Response: resp} 198 return 199} 200 201// List retrieves all the ExpressRouteCrossConnections in a subscription. 202func (client ExpressRouteCrossConnectionsClient) List(ctx context.Context) (result ExpressRouteCrossConnectionListResultPage, err error) { 203 if tracing.IsEnabled() { 204 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.List") 205 defer func() { 206 sc := -1 207 if result.ercclr.Response.Response != nil { 208 sc = result.ercclr.Response.Response.StatusCode 209 } 210 tracing.EndSpan(ctx, sc, err) 211 }() 212 } 213 result.fn = client.listNextResults 214 req, err := client.ListPreparer(ctx) 215 if err != nil { 216 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "List", nil, "Failure preparing request") 217 return 218 } 219 220 resp, err := client.ListSender(req) 221 if err != nil { 222 result.ercclr.Response = autorest.Response{Response: resp} 223 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "List", resp, "Failure sending request") 224 return 225 } 226 227 result.ercclr, err = client.ListResponder(resp) 228 if err != nil { 229 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "List", resp, "Failure responding to request") 230 } 231 232 return 233} 234 235// ListPreparer prepares the List request. 236func (client ExpressRouteCrossConnectionsClient) ListPreparer(ctx context.Context) (*http.Request, error) { 237 pathParameters := map[string]interface{}{ 238 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 239 } 240 241 const APIVersion = "2018-04-01" 242 queryParameters := map[string]interface{}{ 243 "api-version": APIVersion, 244 } 245 246 preparer := autorest.CreatePreparer( 247 autorest.AsGet(), 248 autorest.WithBaseURL(client.BaseURI), 249 autorest.WithPathParameters("/subscriptions/{subscriptionId}/providers/Microsoft.Network/expressRouteCrossConnections", pathParameters), 250 autorest.WithQueryParameters(queryParameters)) 251 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 252} 253 254// ListSender sends the List request. The method will close the 255// http.Response Body if it receives an error. 256func (client ExpressRouteCrossConnectionsClient) ListSender(req *http.Request) (*http.Response, error) { 257 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 258} 259 260// ListResponder handles the response to the List request. The method always 261// closes the http.Response Body. 262func (client ExpressRouteCrossConnectionsClient) ListResponder(resp *http.Response) (result ExpressRouteCrossConnectionListResult, err error) { 263 err = autorest.Respond( 264 resp, 265 client.ByInspecting(), 266 azure.WithErrorUnlessStatusCode(http.StatusOK), 267 autorest.ByUnmarshallingJSON(&result), 268 autorest.ByClosing()) 269 result.Response = autorest.Response{Response: resp} 270 return 271} 272 273// listNextResults retrieves the next set of results, if any. 274func (client ExpressRouteCrossConnectionsClient) listNextResults(ctx context.Context, lastResults ExpressRouteCrossConnectionListResult) (result ExpressRouteCrossConnectionListResult, err error) { 275 req, err := lastResults.expressRouteCrossConnectionListResultPreparer(ctx) 276 if err != nil { 277 return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listNextResults", nil, "Failure preparing next results request") 278 } 279 if req == nil { 280 return 281 } 282 resp, err := client.ListSender(req) 283 if err != nil { 284 result.Response = autorest.Response{Response: resp} 285 return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listNextResults", resp, "Failure sending next results request") 286 } 287 result, err = client.ListResponder(resp) 288 if err != nil { 289 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listNextResults", resp, "Failure responding to next results request") 290 } 291 return 292} 293 294// ListComplete enumerates all values, automatically crossing page boundaries as required. 295func (client ExpressRouteCrossConnectionsClient) ListComplete(ctx context.Context) (result ExpressRouteCrossConnectionListResultIterator, err error) { 296 if tracing.IsEnabled() { 297 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.List") 298 defer func() { 299 sc := -1 300 if result.Response().Response.Response != nil { 301 sc = result.page.Response().Response.Response.StatusCode 302 } 303 tracing.EndSpan(ctx, sc, err) 304 }() 305 } 306 result.page, err = client.List(ctx) 307 return 308} 309 310// ListArpTable gets the currently advertised ARP table associated with the express route cross connection in a 311// resource group. 312// Parameters: 313// resourceGroupName - the name of the resource group. 314// crossConnectionName - the name of the ExpressRouteCrossConnection. 315// peeringName - the name of the peering. 316// devicePath - the path of the device 317func (client ExpressRouteCrossConnectionsClient) ListArpTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result ExpressRouteCrossConnectionsListArpTableFuture, err error) { 318 if tracing.IsEnabled() { 319 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.ListArpTable") 320 defer func() { 321 sc := -1 322 if result.Response() != nil { 323 sc = result.Response().StatusCode 324 } 325 tracing.EndSpan(ctx, sc, err) 326 }() 327 } 328 req, err := client.ListArpTablePreparer(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath) 329 if err != nil { 330 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListArpTable", nil, "Failure preparing request") 331 return 332 } 333 334 result, err = client.ListArpTableSender(req) 335 if err != nil { 336 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListArpTable", result.Response(), "Failure sending request") 337 return 338 } 339 340 return 341} 342 343// ListArpTablePreparer prepares the ListArpTable request. 344func (client ExpressRouteCrossConnectionsClient) ListArpTablePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (*http.Request, error) { 345 pathParameters := map[string]interface{}{ 346 "crossConnectionName": autorest.Encode("path", crossConnectionName), 347 "devicePath": autorest.Encode("path", devicePath), 348 "peeringName": autorest.Encode("path", peeringName), 349 "resourceGroupName": autorest.Encode("path", resourceGroupName), 350 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 351 } 352 353 const APIVersion = "2018-04-01" 354 queryParameters := map[string]interface{}{ 355 "api-version": APIVersion, 356 } 357 358 preparer := autorest.CreatePreparer( 359 autorest.AsPost(), 360 autorest.WithBaseURL(client.BaseURI), 361 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/arpTables/{devicePath}", pathParameters), 362 autorest.WithQueryParameters(queryParameters)) 363 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 364} 365 366// ListArpTableSender sends the ListArpTable request. The method will close the 367// http.Response Body if it receives an error. 368func (client ExpressRouteCrossConnectionsClient) ListArpTableSender(req *http.Request) (future ExpressRouteCrossConnectionsListArpTableFuture, err error) { 369 var resp *http.Response 370 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 371 if err != nil { 372 return 373 } 374 future.Future, err = azure.NewFutureFromResponse(resp) 375 return 376} 377 378// ListArpTableResponder handles the response to the ListArpTable request. The method always 379// closes the http.Response Body. 380func (client ExpressRouteCrossConnectionsClient) ListArpTableResponder(resp *http.Response) (result ExpressRouteCircuitsArpTableListResult, err error) { 381 err = autorest.Respond( 382 resp, 383 client.ByInspecting(), 384 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 385 autorest.ByUnmarshallingJSON(&result), 386 autorest.ByClosing()) 387 result.Response = autorest.Response{Response: resp} 388 return 389} 390 391// ListByResourceGroup retrieves all the ExpressRouteCrossConnections in a resource group. 392// Parameters: 393// resourceGroupName - the name of the resource group. 394func (client ExpressRouteCrossConnectionsClient) ListByResourceGroup(ctx context.Context, resourceGroupName string) (result ExpressRouteCrossConnectionListResultPage, err error) { 395 if tracing.IsEnabled() { 396 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.ListByResourceGroup") 397 defer func() { 398 sc := -1 399 if result.ercclr.Response.Response != nil { 400 sc = result.ercclr.Response.Response.StatusCode 401 } 402 tracing.EndSpan(ctx, sc, err) 403 }() 404 } 405 result.fn = client.listByResourceGroupNextResults 406 req, err := client.ListByResourceGroupPreparer(ctx, resourceGroupName) 407 if err != nil { 408 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListByResourceGroup", nil, "Failure preparing request") 409 return 410 } 411 412 resp, err := client.ListByResourceGroupSender(req) 413 if err != nil { 414 result.ercclr.Response = autorest.Response{Response: resp} 415 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListByResourceGroup", resp, "Failure sending request") 416 return 417 } 418 419 result.ercclr, err = client.ListByResourceGroupResponder(resp) 420 if err != nil { 421 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListByResourceGroup", resp, "Failure responding to request") 422 } 423 424 return 425} 426 427// ListByResourceGroupPreparer prepares the ListByResourceGroup request. 428func (client ExpressRouteCrossConnectionsClient) ListByResourceGroupPreparer(ctx context.Context, resourceGroupName string) (*http.Request, error) { 429 pathParameters := map[string]interface{}{ 430 "resourceGroupName": autorest.Encode("path", resourceGroupName), 431 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 432 } 433 434 const APIVersion = "2018-04-01" 435 queryParameters := map[string]interface{}{ 436 "api-version": APIVersion, 437 } 438 439 preparer := autorest.CreatePreparer( 440 autorest.AsGet(), 441 autorest.WithBaseURL(client.BaseURI), 442 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections", pathParameters), 443 autorest.WithQueryParameters(queryParameters)) 444 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 445} 446 447// ListByResourceGroupSender sends the ListByResourceGroup request. The method will close the 448// http.Response Body if it receives an error. 449func (client ExpressRouteCrossConnectionsClient) ListByResourceGroupSender(req *http.Request) (*http.Response, error) { 450 return client.Send(req, azure.DoRetryWithRegistration(client.Client)) 451} 452 453// ListByResourceGroupResponder handles the response to the ListByResourceGroup request. The method always 454// closes the http.Response Body. 455func (client ExpressRouteCrossConnectionsClient) ListByResourceGroupResponder(resp *http.Response) (result ExpressRouteCrossConnectionListResult, err error) { 456 err = autorest.Respond( 457 resp, 458 client.ByInspecting(), 459 azure.WithErrorUnlessStatusCode(http.StatusOK), 460 autorest.ByUnmarshallingJSON(&result), 461 autorest.ByClosing()) 462 result.Response = autorest.Response{Response: resp} 463 return 464} 465 466// listByResourceGroupNextResults retrieves the next set of results, if any. 467func (client ExpressRouteCrossConnectionsClient) listByResourceGroupNextResults(ctx context.Context, lastResults ExpressRouteCrossConnectionListResult) (result ExpressRouteCrossConnectionListResult, err error) { 468 req, err := lastResults.expressRouteCrossConnectionListResultPreparer(ctx) 469 if err != nil { 470 return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") 471 } 472 if req == nil { 473 return 474 } 475 resp, err := client.ListByResourceGroupSender(req) 476 if err != nil { 477 result.Response = autorest.Response{Response: resp} 478 return result, autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listByResourceGroupNextResults", resp, "Failure sending next results request") 479 } 480 result, err = client.ListByResourceGroupResponder(resp) 481 if err != nil { 482 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "listByResourceGroupNextResults", resp, "Failure responding to next results request") 483 } 484 return 485} 486 487// ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. 488func (client ExpressRouteCrossConnectionsClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string) (result ExpressRouteCrossConnectionListResultIterator, err error) { 489 if tracing.IsEnabled() { 490 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.ListByResourceGroup") 491 defer func() { 492 sc := -1 493 if result.Response().Response.Response != nil { 494 sc = result.page.Response().Response.Response.StatusCode 495 } 496 tracing.EndSpan(ctx, sc, err) 497 }() 498 } 499 result.page, err = client.ListByResourceGroup(ctx, resourceGroupName) 500 return 501} 502 503// ListRoutesTable gets the currently advertised routes table associated with the express route cross connection in a 504// resource group. 505// Parameters: 506// resourceGroupName - the name of the resource group. 507// crossConnectionName - the name of the ExpressRouteCrossConnection. 508// peeringName - the name of the peering. 509// devicePath - the path of the device. 510func (client ExpressRouteCrossConnectionsClient) ListRoutesTable(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result ExpressRouteCrossConnectionsListRoutesTableFuture, err error) { 511 if tracing.IsEnabled() { 512 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.ListRoutesTable") 513 defer func() { 514 sc := -1 515 if result.Response() != nil { 516 sc = result.Response().StatusCode 517 } 518 tracing.EndSpan(ctx, sc, err) 519 }() 520 } 521 req, err := client.ListRoutesTablePreparer(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath) 522 if err != nil { 523 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTable", nil, "Failure preparing request") 524 return 525 } 526 527 result, err = client.ListRoutesTableSender(req) 528 if err != nil { 529 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTable", result.Response(), "Failure sending request") 530 return 531 } 532 533 return 534} 535 536// ListRoutesTablePreparer prepares the ListRoutesTable request. 537func (client ExpressRouteCrossConnectionsClient) ListRoutesTablePreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (*http.Request, error) { 538 pathParameters := map[string]interface{}{ 539 "crossConnectionName": autorest.Encode("path", crossConnectionName), 540 "devicePath": autorest.Encode("path", devicePath), 541 "peeringName": autorest.Encode("path", peeringName), 542 "resourceGroupName": autorest.Encode("path", resourceGroupName), 543 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 544 } 545 546 const APIVersion = "2018-04-01" 547 queryParameters := map[string]interface{}{ 548 "api-version": APIVersion, 549 } 550 551 preparer := autorest.CreatePreparer( 552 autorest.AsPost(), 553 autorest.WithBaseURL(client.BaseURI), 554 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTables/{devicePath}", pathParameters), 555 autorest.WithQueryParameters(queryParameters)) 556 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 557} 558 559// ListRoutesTableSender sends the ListRoutesTable request. The method will close the 560// http.Response Body if it receives an error. 561func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSender(req *http.Request) (future ExpressRouteCrossConnectionsListRoutesTableFuture, err error) { 562 var resp *http.Response 563 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 564 if err != nil { 565 return 566 } 567 future.Future, err = azure.NewFutureFromResponse(resp) 568 return 569} 570 571// ListRoutesTableResponder handles the response to the ListRoutesTable request. The method always 572// closes the http.Response Body. 573func (client ExpressRouteCrossConnectionsClient) ListRoutesTableResponder(resp *http.Response) (result ExpressRouteCircuitsRoutesTableListResult, err error) { 574 err = autorest.Respond( 575 resp, 576 client.ByInspecting(), 577 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 578 autorest.ByUnmarshallingJSON(&result), 579 autorest.ByClosing()) 580 result.Response = autorest.Response{Response: resp} 581 return 582} 583 584// ListRoutesTableSummary gets the route table summary associated with the express route cross connection in a resource 585// group. 586// Parameters: 587// resourceGroupName - the name of the resource group. 588// crossConnectionName - the name of the ExpressRouteCrossConnection. 589// peeringName - the name of the peering. 590// devicePath - the path of the device. 591func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummary(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (result ExpressRouteCrossConnectionsListRoutesTableSummaryFuture, err error) { 592 if tracing.IsEnabled() { 593 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.ListRoutesTableSummary") 594 defer func() { 595 sc := -1 596 if result.Response() != nil { 597 sc = result.Response().StatusCode 598 } 599 tracing.EndSpan(ctx, sc, err) 600 }() 601 } 602 req, err := client.ListRoutesTableSummaryPreparer(ctx, resourceGroupName, crossConnectionName, peeringName, devicePath) 603 if err != nil { 604 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTableSummary", nil, "Failure preparing request") 605 return 606 } 607 608 result, err = client.ListRoutesTableSummarySender(req) 609 if err != nil { 610 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "ListRoutesTableSummary", result.Response(), "Failure sending request") 611 return 612 } 613 614 return 615} 616 617// ListRoutesTableSummaryPreparer prepares the ListRoutesTableSummary request. 618func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummaryPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, peeringName string, devicePath string) (*http.Request, error) { 619 pathParameters := map[string]interface{}{ 620 "crossConnectionName": autorest.Encode("path", crossConnectionName), 621 "devicePath": autorest.Encode("path", devicePath), 622 "peeringName": autorest.Encode("path", peeringName), 623 "resourceGroupName": autorest.Encode("path", resourceGroupName), 624 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 625 } 626 627 const APIVersion = "2018-04-01" 628 queryParameters := map[string]interface{}{ 629 "api-version": APIVersion, 630 } 631 632 preparer := autorest.CreatePreparer( 633 autorest.AsPost(), 634 autorest.WithBaseURL(client.BaseURI), 635 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}/peerings/{peeringName}/routeTablesSummary/{devicePath}", pathParameters), 636 autorest.WithQueryParameters(queryParameters)) 637 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 638} 639 640// ListRoutesTableSummarySender sends the ListRoutesTableSummary request. The method will close the 641// http.Response Body if it receives an error. 642func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummarySender(req *http.Request) (future ExpressRouteCrossConnectionsListRoutesTableSummaryFuture, err error) { 643 var resp *http.Response 644 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 645 if err != nil { 646 return 647 } 648 future.Future, err = azure.NewFutureFromResponse(resp) 649 return 650} 651 652// ListRoutesTableSummaryResponder handles the response to the ListRoutesTableSummary request. The method always 653// closes the http.Response Body. 654func (client ExpressRouteCrossConnectionsClient) ListRoutesTableSummaryResponder(resp *http.Response) (result ExpressRouteCrossConnectionsRoutesTableSummaryListResult, err error) { 655 err = autorest.Respond( 656 resp, 657 client.ByInspecting(), 658 azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted), 659 autorest.ByUnmarshallingJSON(&result), 660 autorest.ByClosing()) 661 result.Response = autorest.Response{Response: resp} 662 return 663} 664 665// UpdateTags updates an express route cross connection tags. 666// Parameters: 667// resourceGroupName - the name of the resource group. 668// crossConnectionName - the name of the cross connection. 669// crossConnectionParameters - parameters supplied to update express route cross connection tags. 670func (client ExpressRouteCrossConnectionsClient) UpdateTags(ctx context.Context, resourceGroupName string, crossConnectionName string, crossConnectionParameters TagsObject) (result ExpressRouteCrossConnectionsUpdateTagsFuture, err error) { 671 if tracing.IsEnabled() { 672 ctx = tracing.StartSpan(ctx, fqdn+"/ExpressRouteCrossConnectionsClient.UpdateTags") 673 defer func() { 674 sc := -1 675 if result.Response() != nil { 676 sc = result.Response().StatusCode 677 } 678 tracing.EndSpan(ctx, sc, err) 679 }() 680 } 681 req, err := client.UpdateTagsPreparer(ctx, resourceGroupName, crossConnectionName, crossConnectionParameters) 682 if err != nil { 683 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "UpdateTags", nil, "Failure preparing request") 684 return 685 } 686 687 result, err = client.UpdateTagsSender(req) 688 if err != nil { 689 err = autorest.NewErrorWithError(err, "network.ExpressRouteCrossConnectionsClient", "UpdateTags", result.Response(), "Failure sending request") 690 return 691 } 692 693 return 694} 695 696// UpdateTagsPreparer prepares the UpdateTags request. 697func (client ExpressRouteCrossConnectionsClient) UpdateTagsPreparer(ctx context.Context, resourceGroupName string, crossConnectionName string, crossConnectionParameters TagsObject) (*http.Request, error) { 698 pathParameters := map[string]interface{}{ 699 "crossConnectionName": autorest.Encode("path", crossConnectionName), 700 "resourceGroupName": autorest.Encode("path", resourceGroupName), 701 "subscriptionId": autorest.Encode("path", client.SubscriptionID), 702 } 703 704 const APIVersion = "2018-04-01" 705 queryParameters := map[string]interface{}{ 706 "api-version": APIVersion, 707 } 708 709 preparer := autorest.CreatePreparer( 710 autorest.AsContentType("application/json; charset=utf-8"), 711 autorest.AsPatch(), 712 autorest.WithBaseURL(client.BaseURI), 713 autorest.WithPathParameters("/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/expressRouteCrossConnections/{crossConnectionName}", pathParameters), 714 autorest.WithJSON(crossConnectionParameters), 715 autorest.WithQueryParameters(queryParameters)) 716 return preparer.Prepare((&http.Request{}).WithContext(ctx)) 717} 718 719// UpdateTagsSender sends the UpdateTags request. The method will close the 720// http.Response Body if it receives an error. 721func (client ExpressRouteCrossConnectionsClient) UpdateTagsSender(req *http.Request) (future ExpressRouteCrossConnectionsUpdateTagsFuture, err error) { 722 var resp *http.Response 723 resp, err = client.Send(req, azure.DoRetryWithRegistration(client.Client)) 724 if err != nil { 725 return 726 } 727 future.Future, err = azure.NewFutureFromResponse(resp) 728 return 729} 730 731// UpdateTagsResponder handles the response to the UpdateTags request. The method always 732// closes the http.Response Body. 733func (client ExpressRouteCrossConnectionsClient) UpdateTagsResponder(resp *http.Response) (result ExpressRouteCrossConnection, err error) { 734 err = autorest.Respond( 735 resp, 736 client.ByInspecting(), 737 azure.WithErrorUnlessStatusCode(http.StatusOK), 738 autorest.ByUnmarshallingJSON(&result), 739 autorest.ByClosing()) 740 result.Response = autorest.Response{Response: resp} 741 return 742} 743